How can I remove vue cli 2?

I use nvm to switch between node versions. In my case I had installed vue-cli on the system node and that had been symlinked to /usr/local/bin/vue

To fix:

nvm use system
npm uninstall -g vue-cli

At this point which vue should return vue not found. In that case you can nvm use your desired version and it should run out of that version's directory.


sudo npm uninstall @vue/cli -g


I solved the same issue you have (or had), I don't know if you already solved it but here is how I solved it.

using which vue I saw where vue was installed.

christianjavan@rog:$ which vue
/usr/bin/vue

Then I deleted all vue files inside the installation folder

christianjavan@rog:/usr/bin$ sudo rm -rf vue
christianjavan@rog:/usr/bin$ sudo rm -rf vue-init
christianjavan@rog:/usr/bin$ sudo rm -rf vue-list

Then I did exactly what it says in this link.

christianjavan@rog:/$ mkdir ~/.npm-global
mkdir: cannot create directory ‘/home/christianjavan/.npm-global’: File exists
christianjavan@rog:/$ npm config set prefix '~/.npm-global'
christianjavan@rog:/$ export PATH=~/.npm-global/bin:$PATH
christianjavan@rog:/$ source ~/.profile

Then I tried to install the new vue cli

christianjavan@rog:/$ npm install -g @vue/cli

Then I did vue --version and finally got the 3.0.3 version installed

christianjavan@rog:/$ vue --version
3.0.3

I really hope this helps.

NOTE: After trying to run vue -V again later, it did't found the vue command, so I exported the new vue directory to the PATH. When you run npm install -g @vue/cli the command gives you the new vue directory.

christianjavan@rog:~$ npm install -g @vue/cli
/home/christianjavan/.npm-global/bin/vue -> /home/christianjavan/.npm-global/lib/node_modules/@vue/cli/bin/vue.js

You add that directory to your PATH.

christianjavan@rog:~$ export PATH=$PATH:/home/christianjavan/.npm-global/bin

I don't know if this will help anyone but

  • To uninstall 2.x I had to:

    npm uninstall -g vue-cli
    
  • To upgrade to 3.x:

    npm install -g @vue/cli