1. Vue uninstall
2. vue installation
2.1, install node.js
https://nodejs.org/en/download/
After the download is complete, according to the general application of windows, you can install it successfully all the way to next. It is recommended not to install it on the system disk
2.2. Set global and cache paths
Description: Setting the path can centralize the modules installed through npm for easy management.
(1) In the installation directory of nodejs, create two new folders, node_global and node_cache
(2) Set global and cache
npm config set prefix "D:\server\nodejs12\node_global"
npm config set cache "D:\server\nodejs12\node_cache"
After the setup is successful, the modules will be in D:\Program Files\nodejs\node_global\node_modules after installation with the command npm install XXX -g
2.3, install cnpm
Note: Since many npm packages are abroad, we use Taobao's mirror server here to install the modules we depend on, so first install "China's npm" - cnpm
The reference website is as follows: http://npm.taobao.org/
npm install -g cnpm --registry=https://registry.npm.taobao.org
2.4, set environment variables (very important)
Description: Setting environment variables allows commands such as cnpm and vue to be used in any directory without entering the full path.
Modify the user variable PATH
Select PATH, click Edit, add English ";" after the existing variable, and then add "D:\server\nodejs12\node_global" to the back
Added system variable NODE_PATH
Click New in the following system variables, a box will pop up, and set the variable value to "D:\server\nodejs12\node_global\node_modules"
In the next two steps, you must first enter the project folder you want to install (directly under D:\server\nodejs12\node_global\node_modules)
2.5, install vue with cnpm
-
cnpm
install vue -g
-
-
install
installation command
-
vue
install module
-
-g
put in global directory
2.6, install the vue command line tool
-
// This installs vue 2.x
-
cnpm install vue-cli -g
-
-
// This installs the latest version of vue
-
npm install -g
@vue/cli
Starting with vue3.0, you can open a web page with vue ui in the terminal, and create a vue project through the web page
The installation is wrong, I want to install vue3.0
When npm installs vue-cli, the speed is slow, and fetchMetadata often gets stuck and reports exceptions
Change the warehouse address of npm to Taobao mirror
npm config set registry https://registry.npm.taobao.org --global
npm config set disturl https://npm.taobao.org/dist --global
Reference article: Building a vue development environment under WIN10