22

I already have vue-cli 3.5.5 installed. When I run vue create myapp, it shows message Update available 3.6.2.

Vue CLI v3.5.5
┌───────────────────────────┐
│  Update available: 3.6.2  │
└───────────────────────────┘

How to upgrade vue-cli to the latest version?

When I run npm i -g vue-cli it installs vue-cli version 2.9.6 instead of upgrading the existing vue cli version.

OS: Ubuntu 18.04.1.

node version: 10.15.3.

nvm version: 0.34.0.

HelloWorld101
  • 3,878
  • 2
  • 34
  • 47
  • Possible duplicate of [Node update a specific package](https://stackoverflow.com/questions/43127863/node-update-a-specific-package) – slhck Apr 15 '19 at 10:15

7 Answers7

36

vue-cli 3.x is changed to @vue/cli. Therefore, no direct upgrade exists.

  1. Uninstall old version if you no longer need it, or if latest install command gives error:
npm uninstall -g vue-cli
  1. Use the following command to install the latest vue-cli version:
$ npm install -g @vue/cli@latest

Notes

  1. Do not run $ npm i -g vue-cli because vue-cli 3.x is changed to @vue/cli.

  2. The vue-cli update issue states that either npm or yarn can be used to upgrade vue-cli. However, when working within nvm, the yarn command yarn global add @vue/cli did not work. If you do not use nvm then installing via yarn might work. However, I did not verify this.

HelloWorld101
  • 3,878
  • 2
  • 34
  • 47
7

For anyone still having this issue I ran through the following steps:

  1. Switched to latest stable Node.js release using Node Version Manager

    nvm install 14.16.0

  2. Uninstalled previous @vue/cli package

    npm uninstall -g @vue/cli

    npm uninstall -g vue-cli (v2.* and older)

  3. Globally installed latest stable release

    npm install -g @vue/cli@latest

  4. Opened a new terminal window for the change to take effect; checked the version by running below command

    vue --version

Kudos to Antony for his original answer.

4

Based on Vuejs - doc, you can update it like this :

npm update -g @vue/cli

# OR

yarn global upgrade --latest @vue/cli
SeyyedKhandon
  • 5,197
  • 8
  • 37
  • 68
3

first uninstall current vue version

npm uninstall -g vue-cli

then install vue

npm install -g @vue/cli

3

Had the same issue on Linux Mint 20. I tried everything possible to npm/yarn reinstall vue-cli or @vue/cli without success; it was always version 2.9.6. So the problem appeared to be wrong vue link instead of the vue-cli version. What did the trick was the command:

whereis vue

which showed two vue binaries:

vue: /usr/local/bin/vue /opt/node-v10.15.3-linux-x64/bin/vue

so changing the vue link from vue -> ../lib/node_modules/vue-cli/bin/vue to vue -> /opt/node-v10.15.3-linux-x64/bin/vue did the trick for me.

krankuba
  • 1,283
  • 1
  • 17
  • 20
1
npm install -g @vue/cli

OR

yarn global add @vue/cli
Roland
  • 24,554
  • 4
  • 99
  • 97
-2

I, you can directly update your vucli but the best way is to delete the old version and install a new version ( it will be up to date). Use what you want. Delete and reinstall or upgrade directly.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459