Vue CLI Overview
Vue CLI is the easiest way to build a new Vue app.
It provides:
- a command-line utility for you to choose build tools
- official plugins
- runtime dependency built on top of webpack with sensible defaults
Installation & Update
Run one of the following commands.
Vue CLI 4.x requires Node.js version 8.9 or above. Manage multiple versions of Node with nvm.
$ npm install -g @vue/cli
# OR
$ yarn global add @vue/cli
Check if you did it right↓
$ vue --version
To upgrade the global Vue CLI package, run↓
$ npm update -g @vue/cli
# OR
$ yarn global upgrade --latest @vue/cli
Creating a Project
To create a new project, run↓
$ vue create <project name>
and you'll be prompted to pick a preset. You can either choose the default preset or select "Manually select features" to pick the versions and features you need.
Troubleshooting
Vue command not found error after installation
a. Uninstall vue/cli and install it again
(and then restarting terminal recommended)
$ npm uninstall -g @vue/cli
# OR
$ yarn global remove @vue/cli
If the globall installation fails, try running command with prefix 'sudo'.
$ sudo npm uninstall vue-cli -g
$ sudo npm install -g @vue/cli
b. Uninstall and install node again with the right version
check installed node version↓
$ node --verison
How to uninstall Node.js completely
c. Add PATH environment variable
Run following command to see where npm puts your globally installed packages.
$ npm config get prefix
# output example(windows)
# C:\Users\{UserName}\AppData\Roaming\npm
Check if your operating system has the PATH environment variable. If not, add the path you got from the command above.
How to add PATH environment variable on WINDOWS
Open command promt(windows key + R) and run command↓
$ set
It will show you PATHs added to your OS. Try update it on Windows Control Panel.
Control Panel > System and Security > System > Advanced system settings > Environment Variables...
Sources
https://cli.vuejs.org/
https://bobbyhadz.com/blog/npm-command-not-found-vue
Top comments (0)