vuejs/vue-cli · error · Error

Cannot resolve plugin ${pluginName} from package.json. Did y

Error message

Cannot resolve plugin ${pluginName} from package.json. Did you forget to install it?

What it means

Thrown during `vue invoke <plugin>` when the named plugin cannot be resolved from the project's package.json dependencies or devDependencies. The invoke command searches for the plugin under @vue/cli-plugin-, vue-cli-plugin-, scoped variants, and the full resolved ID; if none appears in the dependency lists, it assumes the plugin was never installed.

Source

Thrown at packages/@vue/cli/lib/invoke.js:47

  const pkg = getPkg(context)

  // attempt to locate the plugin in package.json
  const findPlugin = deps => {
    if (!deps) return
    let name
    // official
    if (deps[(name = `@vue/cli-plugin-${pluginName}`)]) {
      return name
    }
    // full id, scoped short, or default short
    if (deps[(name = resolvePluginId(pluginName))]) {
      return name
    }
  }

  const id = findPlugin(pkg.devDependencies) || findPlugin(pkg.dependencies)
  if (!id) {
    throw new Error(
      `Cannot resolve plugin ${chalk.yellow(pluginName)} from package.json. ` +
        `Did you forget to install it?`
    )
  }

  const pluginGenerator = loadModule(`${id}/generator`, context)
  if (!pluginGenerator) {
    throw new Error(`Plugin ${id} does not have a generator.`)
  }

  // resolve options if no command line options (other than --registry) are passed,
  // and the plugin contains a prompt module.
  // eslint-disable-next-line prefer-const
  let { registry, $inlineOptions, ...pluginOptions } = options
  if ($inlineOptions) {
    try {
      pluginOptions = JSON.parse($inlineOptions)
    } catch (e) {

View on GitHub (pinned to 7eb93c169c)

Solutions

  1. Install the plugin first: npm install -D @vue/cli-plugin-<name> (or vue-cli-plugin-<name> for community plugins).
  2. Double-check the plugin name spelling and prefix conventions.
  3. Run `npm list | grep cli-plugin` to see what's actually installed.

Example fix

# before
$ vue invoke router  # not installed
Error: Cannot resolve plugin router
# after
$ npm install -D @vue/cli-plugin-router
$ vue invoke router
Defensive patterns

Strategy: validation

Validate before calling

const pkg = require('./package.json');
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
const candidates = [
  `@vue/cli-plugin-${name}`,
  `vue-cli-plugin-${name}`,
  `${name}`,
  `@vue/${name}`,
];
const found = candidates.find(c => deps[c]);
if (!found) console.error(`Plugin ${name} not found in package.json. Install it first.`);

Try / catch

try {
  await invoke(pluginName, options);
} catch (e) {
  if (e.message.includes('Cannot resolve plugin')) {
    console.error(`Install the plugin first: npm install -D @vue/cli-plugin-${pluginName}`);
    process.exit(1);
  }
  throw e;
}

Prevention

When it happens

Trigger: Running `vue invoke router` when @vue/cli-plugin-router is not in package.json. Or `vue invoke my-plugin` when vue-cli-plugin-my-plugin is not installed.

Common situations: User hasn't installed the plugin yet, typos the plugin name, or the plugin was scaffolded but not saved as a dependency. Also when invoking a plugin that was uninstalled.

Related errors


AI-assisted analysis of vuejs/vue-cli@7eb93c169c (2026-08-13). Data as JSON: /api/errors/9152e9f81f73a260. Report an issue: GitHub.