Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 670
Antony Avatar asked Apr 15 '19 10:04

Antony


People also ask

How do I update my vue to latest version?

@OrestesKappa Just install vue at the version you want or just use npm install vue@latest --save to get the latest (note that updating from 2 to 3 requires quite some changes and many extensions haven't been updated yet).

What is the latest vue cli version?

5.0. 3 (2022-03-15)

Should I install vue cli globally?

In my personal opinion, you should just install @vue/cli in your home or $HOME , and export the binaries from node modules bin folder to access it globally without providing a sudo password. Avoid the -g flag while installing.


2 Answers

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.

like image 156
Antony Avatar answered Sep 22 '22 00:09

Antony


As the docs https://cli.vuejs.org/guide/installation.html#upgrading mentioned, you can update it like this :

npm update -g @vue/cli

# OR
yarn global upgrade --latest @vue/cli
like image 36
SeyyedKhandon Avatar answered Sep 21 '22 00:09

SeyyedKhandon