1. Install node.js
- Download the installation package from the node.js official website , select the stable version (LTS), and install it in the next step
- Check whether node.js is installed successfully:
node -v
, if the version number appears, the installation is successful - Detect npm:
npm -v
2. Install webpack
- Install webpack globally:
npm install webpack -g
- At the same time, you need to install webpack-cli, run
cnpm install webpack-cli -g
- Check the webpack version:
webpack -v
3. Install vue-cli 2.x
-
run
npm install vue-cli -g
-
If the previous step has been installed for a long time, or the installation fails, switch to the Taobao image first
npm install -g cnpm --registry=https://registry.npm.taobao.org
, and then execute the installation commandcnpm install vue-cli -g
-
Create project:
vue init webpack 项目名(不要取中文)
-
Verify that the installation was successful:
vue -V
4. Install vue-cli 3.x
- Install the latest version:
cnpm install @vue/cli -g
- Install the specified version:
cnpm install @vue/[email protected] -g
- Create project:
vue create 项目名(不要取中文)
- Run the project:
cnpm run serve