vuejs/vue-cli · error · Error
Require @vue/cli-service "${range}", but was loaded with "${
Error message
Require @vue/cli-service "${range}", but was loaded with "${this.version}". What it means
assertVersion's final check runs `semver.satisfies(this.version, range, { includePrerelease: true })` using the loaded @vue/cli-service version. If the loaded version does not satisfy the requested range, it throws naming both the required range and the actual version, so plugin/cli incompatibility is obvious.
Source
Thrown at packages/@vue/cli-service/lib/PluginAPI.js:37
get version () {
return require('../package.json').version
}
assertVersion (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.version, range, { includePrerelease: true })) return
throw new Error(
`Require @vue/cli-service "${range}", but was loaded with "${this.version}".`
)
}
/**
* Current working directory.
*/
getCwd () {
return this.service.context
}
/**
* Resolve path for a project.
*
* @param {string} _path - Relative path from project root
* @return {string} The resolved absolute path.
*/
resolve (_path) {View on GitHub (pinned to 7eb93c169c)
Solutions
- Align all @vue/cli-* and @vue/cli-service versions to the same major (e.g. all `^5`).
- Run `npm update @vue/cli-service` (or the vue CLI migration install).
- Check `npx vue --version` against the project's `@vue/cli-service` version and reconcile.
Defensive patterns
Strategy: validation
Validate before calling
const semver = require('semver')
const loaded = require('@vue/cli-service/package.json').version
if (!semver.satisfies(loaded, range, { includePrerelease: true })) {
console.warn(`Loaded @vue/cli-service ${loaded} does not satisfy ${range}`)
} Try / catch
try { api.assertVersion(range) } catch (e) { /* log and instruct user to align cli versions */ throw e } Prevention
- Keep all @vue/cli-* packages on the same major in package.json.
- Run `vue upgrade` rather than bumping one package at a time.
When it happens
Trigger: A plugin requiring a newer (or different major of) @vue/cli-service than the one actually loaded into the project — e.g. plugin built for cli-service 5 running under cli-service 4.
Common situations: Global @vue/cli version differing from the project's local @vue/cli-service; partial upgrade of one @vue/* package without the others; monorepo with mixed cli-service majors.
Related errors
- Expected string or integer value.
- Expected string or integer value.
- Require global @vue/cli "${range}", but was invoked by "${th
- Require @vue/cli-service "${range}", but was loaded with "${
- 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/d42e5a7435144086.
Report an issue: GitHub.