How to update vue-cli to latest version?
Article about how to update vue-cli from version 2 to latest versions like Vue CLI 3 or 4.
While creating a Vue project, if you see a message to update to the latest version like Vue CLI v3.5.0 or above. Then you have to follow the steps below to update your Vue CLI to the lastest stable version.
If you are using version 2 or older then you have to uninstall it first.
Uninstall old vue-cli version
The vue-cli is the older version and the package name is changed from vue-cli to @vue/cli.
So to install or update your vue-cli, you have to uninstall the older version first.
To uninstall, type this command (if you are on older version 2 or older ) :
npm uninstall -g vue-cli
If you want to uninstall vue/cli version 3 or above. (You can skip this part, if you just want to update)
npm uninstall -g @vue/cli
This will uninstall the package globally from your computer.
Install latest version of vue/cli
This command will install vue-cli latest version globally in your computer.
npm install -g @vue/cli@latest // OR yarn global add @vue/cli
After installation you can verify if vue is installed properly in your computer by running vue in your command line. It will list all the available commands for vue.
To check vue version type:
vue --version
NOTE:
Its better to have the latest stable version of NodeJS when you update / install Vue CLI in your computer.
Update vue-cli to latest version (v3 or v4)
If you are still on version 2 or older of Vue CLI, you cannot update directly using npm upgrade , then you have to follow the steps shown above.
First uninstall the older version using:
npm uninstall -g vue-cli
And then install the lastest version of the package using:
npm install -g @vue/cli@latest
If you are using the version 3 , then to upgrade the global Vue CLI package, run:
npm update -g @vue/cli # OR yarn global upgrade --latest @vue/cli
Related Topics:
Related Posts
Easy Way to use localStorage with Vue
Short article on how to use local storage with Vue and learn saving and storing data in local storage with the setItem() and getItem() methods.
Force update Vue to Reload/Rerender component
Short tutorial on how to correctly force update Vue.js component to reload or rerender. The component is reinitialized without having to do a browser refresh.
Set and get cookies in a browser in Vue App
Find out how to set and get cookies in a browser for your webpage in Vue using vue-cookies package.
Save vuex state after page refresh in Vue App
Short tutorial on how to save (or persist) data in a vue application using Vuex and vuex-persist npm package.
