vuejs/vue-cli · error · Error
Require global @vue/cli "${range}", but was invoked by "${th
Error message
Require global @vue/cli "${range}", but was invoked by "${this.cliVersion}". What it means
Thrown by assertCliVersion when the globally installed @vue/cli version does not satisfy the semver range required by the calling plugin/generator. The method compares the current CLI version against the range using semver.satisfies with includePrerelease, and throws if it fails.
Source
Thrown at packages/@vue/cli/lib/GeneratorAPI.js:125
get cliVersion () {
return require('../package.json').version
}
assertCliVersion (range) {
if (typeof range === 'number') {
if (!Number.isInteger(range)) {
throw new Error('Expected string or integer value.')
}
range = `^${range}.0.0-0`
}
if (typeof range !== 'string') {
throw new Error('Expected string or integer value.')
}
if (semver.satisfies(this.cliVersion, range, { includePrerelease: true })) return
throw new Error(
`Require global @vue/cli "${range}", but was invoked by "${this.cliVersion}".`
)
}
get cliServiceVersion () {
// In generator unit tests, we don't write the actual file back to the disk.
// So there is no cli-service module to load.
// In that case, just return the cli version.
if (process.env.VUE_CLI_TEST && process.env.VUE_CLI_SKIP_WRITE) {
return this.cliVersion
}
const servicePkg = loadModule(
'@vue/cli-service/package.json',
this.generator.context
)
return servicePkg.versionView on GitHub (pinned to 7eb93c169c)
Solutions
- Upgrade the global @vue/cli to satisfy the required range: npm install -g @vue/cli@latest (or yarn global add @vue/cli).
- If you cannot upgrade, downgrade the plugin to a version compatible with your current CLI.
- Check your CLI version with `vue --version` and compare it to the range in the error message.
Example fix
# before $ vue --version # 3.12.1 plugin requires ^4.0.0 # after $ npm install -g @vue/cli@4 $ vue --version # 4.5.15
Defensive patterns
Strategy: validation
Validate before calling
const semver = require('semver');
const currentVersion = require('@vue/cli/package.json').version;
if (!semver.satisfies(currentVersion, requiredRange, { includePrerelease: true })) {
console.warn(`@vue/cli ${currentVersion} does not satisfy ${requiredRange}. Upgrade with: npm i -g @vue/cli@latest`);
} Try / catch
try {
generatorAPI.assertCliVersion('^4.0.0');
} catch (e) {
if (e.message.includes('Require global @vue/cli')) {
console.error('CLI version mismatch. Run: npm install -g @vue/cli@latest');
process.exit(1);
}
throw e;
} Prevention
- Check your CLI version with `vue --version` before running plugins with version requirements.
- Keep the global @vue/cli updated alongside plugin updates.
- Document the required CLI version in your plugin README.
When it happens
Trigger: A plugin generator calls assertCliVersion('^4.0.0') but the user is running @vue/cli 3.x globally. Or assertCliVersion(5) is called when the global CLI is version 4.5.0.
Common situations: User upgrades a plugin that requires a newer CLI version but hasn't upgraded the global @vue/cli package. Mismatch between globally installed CLI and plugin version requirements after a team updates dependencies.
Related errors
- Require @vue/cli-service "${range}", but was loaded with "${
- Expected string or integer value.
- Require @vue/cli-service "${range}", but was loaded with "${
- Expected string or integer value.
- You are using an outdated version of NPM. It does not suppor
AI-assisted analysis of vuejs/vue-cli@7eb93c169c (2026-08-13).
Data as JSON: /api/errors/d2e629918e065e0f.
Report an issue: GitHub.