diff --git a/packages/@vue/cli/lib/add.js b/packages/@vue/cli/lib/add.js index a2a3368013..d00afb2e12 100644 --- a/packages/@vue/cli/lib/add.js +++ b/packages/@vue/cli/lib/add.js @@ -20,7 +20,7 @@ async function add (pluginName, options = {}, context = process.cwd()) { // for `vue add` command in 3.x projects const servicePkg = loadModule('@vue/cli-service/package.json', context) - if (semver.satisfies(servicePkg.version, '3.x')) { + if (servicePkg && semver.satisfies(servicePkg.version, '3.x')) { // special internal "plugins" if (/^(@vue\/)?router$/.test(pluginName)) { return addRouter(context)