vuejs/vue-cli · error · Error
Can't find ${packageName} in package.json
Error message
Can't find ${packageName} in package.json What it means
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.
Source
Thrown at packages/@vue/cli/lib/Upgrader.js:66
await this.upgrade(p.name, { to: p.latest })
}
done('All plugins are up to date!')
}
async upgrade (pluginId, options) {
const packageName = resolvePluginId(pluginId)
let depEntry, required
for (const depType of ['dependencies', 'devDependencies', 'optionalDependencies']) {
if (this.pkg[depType] && this.pkg[depType][packageName]) {
depEntry = depType
required = this.pkg[depType][packageName]
break
}
}
if (!required) {
throw new Error(`Can't find ${chalk.yellow(packageName)} in ${chalk.yellow('package.json')}`)
}
const installed = options.from || this.pm.getInstalledVersion(packageName)
if (!installed) {
throw new Error(
`Can't find ${chalk.yellow(packageName)} in ${chalk.yellow('node_modules')}. Please install the dependencies first.\n` +
`Or to force upgrade, you can specify your current plugin version with the ${chalk.cyan('--from')} option`
)
}
let targetVersion = options.to || 'latest'
// if the targetVersion is not an exact version
if (!/\d+\.\d+\.\d+/.test(targetVersion)) {
if (targetVersion === 'latest') {
logWithSpinner(`Getting latest version of ${packageName}`)
} else {
logWithSpinner(`Getting max satisfying version of ${packageName}@${options.to}`)
}View on GitHub (pinned to 7eb93c169c)
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.
Example fix
# before $ vue upgrade babel # not in package.json # after $ npm install -D @vue/cli-plugin-babel $ vue upgrade @vue/cli-plugin-babel
Defensive patterns
Strategy: validation
Validate before calling
const pkg = require('./package.json');
const depTypes = ['dependencies', 'devDependencies', 'optionalDependencies'];
const isListed = depTypes.some(dt => pkg[dt] && pkg[dt][pluginName]);
if (!isListed) {
console.error(`${pluginName} is not in package.json. Install it first.`);
} Try / catch
try {
await upgrader.upgrade(pluginId, options);
} catch (e) {
if (e.message.includes("Can't find") && e.message.includes('package.json')) {
console.error(`Plugin not in package.json. Run: npm install -D ${pluginId}`);
process.exit(1);
}
throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Cannot resolve plugin ${pluginName} from package.json. Did y
- Can't find ${packageName} in node_modules. Please install th
- At least one dependency can't be found. Please install the d
- Cannot resolve "@vue/vue${vueVersion}-jest" module. Please m
- Cannot resolve "ts-jest" module. Typescript preset requires
AI-assisted analysis of vuejs/vue-cli@7eb93c169c (2026-08-13).
Data as JSON: /api/errors/c6bd04461a1c2c0b.
Report an issue: GitHub.