How to upgrade my global vue-cli install to the latest version?
Asked Answered
P

7

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.

Paraselene answered 15/4, 2019 at 10:13 Comment(1)
Possible duplicate of Node update a specific packageRhizoid
P
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.

Paraselene answered 15/4, 2019 at 10:13 Comment(4)
@Cosmos are you using nvm or not? For me, yarn add did not work with nvm.Paraselene
I am not using nvm.Ingaingaberg
@Ingaingaberg thank you for your response, good to know that yarn add works when you do not use nvm.Paraselene
After reinstalling don't forget to exit the terminal session and enter a new one to use the new version.Labyrinthodont
S
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.

Secrecy answered 28/3, 2021 at 14:58 Comment(0)
A
4

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

npm update -g @vue/cli

# OR

yarn global upgrade --latest @vue/cli
Allx answered 16/5, 2020 at 5:14 Comment(0)
C
3

first uninstall current vue version

npm uninstall -g vue-cli

then install vue

npm install -g @vue/cli

Curate answered 15/8, 2019 at 9:47 Comment(0)
H
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.

Halvorson answered 2/9, 2020 at 9:23 Comment(0)
P
1
npm install -g @vue/cli

OR

yarn global add @vue/cli
Prophecy answered 29/1, 2020 at 10:22 Comment(0)
D
-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.

Dispenser answered 3/11, 2020 at 1:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.