Search code examples
vue.jsterminalvue-cli

How can I remove vue cli 2?


I want to create a vue project with @vue/cli .

As you know vue/cli update to version 3.

Document says vue doc and I'm in ubuntu 17.10 , try to remove vue-cli with npm uninstall vue-cli -g .

But in the terminal I'm only still have access to vue-cli command.

And with vue --version still got steel 2.8.2.


Solution

  • 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