Vue-cli: Adding Plugins

Created on 25 May 2018  路  6Comments  路  Source: vuejs/vue-cli

Version

3.0.0-beta.11

Reproduction link

https://github.com/DarkPurple141/bug-reproduce

Steps to reproduce

vue create new_project
[ select default ]
cd new_project
vue add vuex

What is expected?

The vuex plugin is added to the project

What is actually happening?

 ERROR  Error: Cannot find module '@vue/cli-service/generator/vuex'
Error: Cannot find module '@vue/cli-service/generator/vuex'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:571:15)
    at Function.Module._load (internal/modules/cjs/loader.js:497:25)
    at Module.require (internal/modules/cjs/loader.js:626:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at addVuex (/usr/local/lib/node_modules/@vue/cli/lib/add.js:57:12)
    at add (/usr/local/lib/node_modules/@vue/cli/lib/add.js:20:12)
    at module.exports.args (/usr/local/lib/node_modules/@vue/cli/lib/add.js:63:10)
    at Command.program.command.allowUnknownOption.description.action (/usr/local/lib/node_modules/@vue/cli/bin/vue.js:57:26)
    at Command.listener (/usr/local/lib/node_modules/@vue/cli/node_modules/commander/index.js:315:8)
    at Command.emit (events.js:182:13)

Not sure if this is a bug or I'm using the plugin system incorrectly. For now I just reverted to doing things the old fashioned way, npm i --save-dev package. But maybe this is fine anyway?

Just ran into it after getting started and looking at the basic CLI api.

bug

All 6 comments

$ vue add --help

  Usage: add [options] <plugin> [pluginOptions]

  install a plugin and invoke its generator in an already created project

  Options:

    -h, --help  output usage information

Use vue add to add plugin, vuex is not a plugin! Maybe you just want npm install vuex or yarn add vuex

Since beta.11 this feature was added for vue-router and vuex, so this seems not to be working as expected here.

I checked the CHANGELOG, my mistake.

I was able to add vuex.

Seems that upgrading npm to v6+ solved for me. But still able to reproduce with 5.6.

The latest beta of vue-cli 3 officially supports Node 8 or newer.

Was this page helpful?
0 / 5 - 0 ratings