{"record":{"id":"d961e701d8c9525f","repo":"vuejs/vue-cli","slug":"can-t-find-packagename-in-node-modules-please","errorCode":null,"errorMessage":"Can't find ${packageName} in node_modules. Please install the dependencies first.\nOr to force upgrade, you can specify your current plugin version with the --from option","messagePattern":"Can't find (.+?) in node_modules\\. Please install the dependencies first\\.\nOr to force upgrade, you can specify your current plugin version with the --from option","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@vue/cli/lib/Upgrader.js","lineNumber":71,"sourceCode":"\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      }\n\n      targetVersion = await this.pm.getRemoteVersion(packageName, targetVersion)\n      if (!options.to && options.next) {\n        const next = await this.pm.getRemoteVersion(packageName, 'next')\n        if (next) {","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/vuejs/vue-cli/blob/7eb93c169c7520935252e2473387f923ef80d856/packages/@vue/cli/lib/Upgrader.js#L53-L89","documentation":"Thrown by Upgrader.upgrade when the plugin is listed in package.json but is not actually installed in node_modules (getInstalledVersion returns null/undefined). The upgrader needs to know the currently installed version to compute the upgrade; it suggests using --from to override.","triggerScenarios":"Running `vue upgrade <plugin>` after package.json was edited but `npm install` was never run, or after node_modules was deleted. Also when the dependency is listed but node_modules is corrupted or partially installed.","commonSituations":"Fresh clone where dependencies haven't been installed yet, or after a failed/partial npm install. CI environment that restores package.json but not node_modules.","solutions":["Run npm install (or yarn install / pnpm install) first to populate node_modules.","If install is failing or you know the version, use the --from flag: vue upgrade <plugin> --from <current-version>.","Delete node_modules and package-lock.json, then reinstall cleanly."],"exampleFix":"# before\n$ vue upgrade @vue/cli-plugin-babel  # node_modules missing\n# after\n$ npm install\n$ vue upgrade @vue/cli-plugin-babel\n# or force\n$ vue upgrade @vue/cli-plugin-babel --from 4.5.0","handlingStrategy":"validation","validationCode":"const { existsSync } = require('fs');\nconst path = require('path');\nif (!existsSync(path.join('node_modules', packageName, 'package.json'))) {\n  console.error(`${packageName} not installed. Run: npm install`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await upgrader.upgrade(pluginId, options);\n} catch (e) {\n  if (e.message.includes(\"node_modules\")) {\n    console.error('Run npm install first, or use --from to specify current version.');\n    process.exit(1);\n  }\n  throw e;\n}","preventionTips":["Always run `npm install` before `vue upgrade`.","Ensure node_modules is intact after git operations or CI setup.","Use --from flag when you know the version but node_modules is unavailable."],"tags":["upgrade","dependency","node-modules","environment"],"backgroundTag":null,"analyzedSha":"7eb93c169c7520935252e2473387f923ef80d856","analyzedAt":"2026-08-13T10:13:37.803Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}