{"record":{"id":"d42e5a7435144086","repo":"vuejs/vue-cli","slug":"require-vue-cli-service-range-but-was-loade","errorCode":null,"errorMessage":"Require @vue/cli-service \"${range}\", but was loaded with \"${this.version}\".","messagePattern":"Require @vue/cli-service \"(.+?)\", but was loaded with \"(.+?)\"\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@vue/cli-service/lib/PluginAPI.js","lineNumber":37,"sourceCode":"\n  get version () {\n    return require('../package.json').version\n  }\n\n  assertVersion (range) {\n    if (typeof range === 'number') {\n      if (!Number.isInteger(range)) {\n        throw new Error('Expected string or integer value.')\n      }\n      range = `^${range}.0.0-0`\n    }\n    if (typeof range !== 'string') {\n      throw new Error('Expected string or integer value.')\n    }\n\n    if (semver.satisfies(this.version, range, { includePrerelease: true })) return\n\n    throw new Error(\n      `Require @vue/cli-service \"${range}\", but was loaded with \"${this.version}\".`\n    )\n  }\n\n  /**\n   * Current working directory.\n   */\n  getCwd () {\n    return this.service.context\n  }\n\n  /**\n   * Resolve path for a project.\n   *\n   * @param {string} _path - Relative path from project root\n   * @return {string} The resolved absolute path.\n   */\n  resolve (_path) {","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/vuejs/vue-cli/blob/7eb93c169c7520935252e2473387f923ef80d856/packages/@vue/cli-service/lib/PluginAPI.js#L19-L55","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const semver = require('semver')\nconst loaded = require('@vue/cli-service/package.json').version\nif (!semver.satisfies(loaded, range, { includePrerelease: true })) {\n  console.warn(`Loaded @vue/cli-service ${loaded} does not satisfy ${range}`)\n}","typeGuard":null,"tryCatchPattern":"try { api.assertVersion(range) } catch (e) { /* log and instruct user to align cli versions */ throw e }","preventionTips":["Keep all @vue/cli-* packages on the same major in package.json.","Run `vue upgrade` rather than bumping one package at a time."],"tags":["plugin-api","version","compatibility"],"backgroundTag":null,"analyzedSha":"7eb93c169c7520935252e2473387f923ef80d856","analyzedAt":"2026-08-13T10:13:37.803Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}