{"record":{"id":"c6bd04461a1c2c0b","repo":"vuejs/vue-cli","slug":"can-t-find-packagename-in-package-json","errorCode":null,"errorMessage":"Can't find ${packageName} in package.json","messagePattern":"Can't find (.+?) in package\\.json","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@vue/cli/lib/Upgrader.js","lineNumber":66,"sourceCode":"      await this.upgrade(p.name, { to: p.latest })\n    }\n\n    done('All plugins are up to date!')\n  }\n\n  async upgrade (pluginId, options) {\n    const packageName = resolvePluginId(pluginId)\n\n    let depEntry, required\n    for (const depType of ['dependencies', 'devDependencies', 'optionalDependencies']) {\n      if (this.pkg[depType] && this.pkg[depType][packageName]) {\n        depEntry = depType\n        required = this.pkg[depType][packageName]\n        break\n      }\n    }\n    if (!required) {\n      throw new Error(`Can't find ${chalk.yellow(packageName)} in ${chalk.yellow('package.json')}`)\n    }\n\n    const installed = options.from || this.pm.getInstalledVersion(packageName)\n    if (!installed) {\n      throw new Error(\n        `Can't find ${chalk.yellow(packageName)} in ${chalk.yellow('node_modules')}. Please install the dependencies first.\\n` +\n        `Or to force upgrade, you can specify your current plugin version with the ${chalk.cyan('--from')} option`\n      )\n    }\n\n    let targetVersion = options.to || 'latest'\n    // if the targetVersion is not an exact version\n    if (!/\\d+\\.\\d+\\.\\d+/.test(targetVersion)) {\n      if (targetVersion === 'latest') {\n        logWithSpinner(`Getting latest version of ${packageName}`)\n      } else {\n        logWithSpinner(`Getting max satisfying version of ${packageName}@${options.to}`)\n      }","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/vuejs/vue-cli/blob/7eb93c169c7520935252e2473387f923ef80d856/packages/@vue/cli/lib/Upgrader.js#L48-L84","documentation":"Thrown by Upgrader.upgrade when the specified plugin cannot be found in any of dependencies, devDependencies, or optionalDependencies in the project's package.json. The upgrader resolves the plugin ID, then searches all dependency types; if none contains it, the plugin is not declared as a project dependency.","triggerScenarios":"Running `vue upgrade <plugin>` where <plugin> is not listed in package.json dependencies/devDependencies. Or running `vue upgrade` with a typo in the plugin name.","commonSituations":"User typos the plugin name, or the plugin was never installed (only scaffolded files exist). The plugin was removed from package.json but the user still tries to upgrade it.","solutions":["Verify the plugin name matches an entry in package.json — use `npm list | grep vue-cli-plugin` or check the file directly.","Install the plugin first: npm install -D <plugin-name>, then run vue upgrade.","Check for typos: the plugin name can omit the (@vue/|vue-|@scope/vue)-cli-plugin- prefix but must resolve correctly."],"exampleFix":"# before\n$ vue upgrade babel  # not in package.json\n# after\n$ npm install -D @vue/cli-plugin-babel\n$ vue upgrade @vue/cli-plugin-babel","handlingStrategy":"validation","validationCode":"const pkg = require('./package.json');\nconst depTypes = ['dependencies', 'devDependencies', 'optionalDependencies'];\nconst isListed = depTypes.some(dt => pkg[dt] && pkg[dt][pluginName]);\nif (!isListed) {\n  console.error(`${pluginName} is not in package.json. Install it first.`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await upgrader.upgrade(pluginId, options);\n} catch (e) {\n  if (e.message.includes(\"Can't find\") && e.message.includes('package.json')) {\n    console.error(`Plugin not in package.json. Run: npm install -D ${pluginId}`);\n    process.exit(1);\n  }\n  throw e;\n}","preventionTips":["Verify the plugin is listed in package.json before running vue upgrade.","Use exact plugin IDs to avoid resolution ambiguity.","Run `npm list --depth=0` to see installed plugins."],"tags":["upgrade","dependency","package-json","plugin"],"backgroundTag":null,"analyzedSha":"7eb93c169c7520935252e2473387f923ef80d856","analyzedAt":"2026-08-13T10:13:37.803Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}