① Install node.js suitable for your own system.
Download address: https://nodejs.org/en/download
![](https://img-blog.csdnimg.cn/img_convert/7de2e97f331cefd2deda0ce11a3c42f8.png)
After downloading, double-click to run, and then continue to next, waiting for the installation to be successful.
Press the win+R key, enter "cmd" and press Enter, and enter in the pop-up command line window: npm --version
The version information appears to prove that the installation was successful:
![](https://img-blog.csdnimg.cn/img_convert/70ab1fe43152d9299d2936529ec02a21.png)
②Create a new folder
Find the installation directory of node.js, and create two new folders, node_global and node_cache.
They are the default installation directory and cache log directory respectively.
![](https://img-blog.csdnimg.cn/img_convert/5aa572c84b628883c909f4cff71e4050.png)
③Set the npm download directory
use:
npm config set prefix "C:\Program Files\nodejs\node_global"
npm config set cache "C:\Program Files\nodejs\node_cache"
The command points the npm module directory and cache directory to the two folders in the second step, remember to replace the path with the path of your computer.
④ Set environment variables.
Right-click "My Computer", "Properties" - "Advanced System Settings" - "Advanced" - "Environment Variables" to enter the Environment Variables dialog box.
![](https://img-blog.csdnimg.cn/img_convert/c1d13010bdc9445044efa2ed25799c8c.png)
![](https://img-blog.csdnimg.cn/img_convert/b53a622e3ddd41199cb9e40bdb0fc458.png)
![](https://img-blog.csdnimg.cn/img_convert/9f3d6701235f9107de725364faf15a1a.png)
![](https://img-blog.csdnimg.cn/img_convert/04cd8963027c439447aac2fcfbb69252.png)
![](https://img-blog.csdnimg.cn/img_convert/f2b166d81a4a6f8f8c239c7192141f9b.png)
![](https://img-blog.csdnimg.cn/img_convert/562d7dccd832da4f8044e13e252b4d3b.png)
In the path of user variables in this step, you need to delete the default C :\APPData\Roaming\npm first, and then add the following two paths.
![](https://img-blog.csdnimg.cn/img_convert/6335bc01586ce33d7f000c11438c990e.png)
⑤ Configure mirroring
Modify the warehouse address of the npm command to Taobao mirror source.
Enter in the command line window: npm config set registry https://registry.npm.taobao.org
Then enter: npm config list to check whether the configuration is successful.
![](https://img-blog.csdnimg.cn/img_convert/e684dec1eb667430fc8131c7d8bf6305.png)
⑥Install vue.js
Enter in the command line window: npm install vue -g
The following error may occur in this step: Error: EPERM: operation not permitted, mkdir
![](https://img-blog.csdnimg.cn/img_convert/f7fa913e3c82d4cb717f1aa824553925.png)
At this time, you need to find the folder in the picture, right-click [Properties]-[Security]-[Edit], and modify the user's permissions to full control.
Successful installation:
![](https://img-blog.csdnimg.cn/img_convert/75c4e983032557b6a9cec14fb1abeb27.png)
可以使用:npm info vue命令查询安装的vue信息
⑦安装脚手架。
使用:npm install vue-cli -g命令安装脚手架。
安装成功后可以使用vue -V命令查看到vue的版本。
如果提示“vue不是内部或外部命令,也不是可运行的程序或批处理文件”,可以尝试将命令行窗口重启,或检查环境变量的配置(第四步)。
至此,vue环境安装完成。
后续步骤
创建vue项目并运行的后续步骤,请阅读:http://t.csdn.cn/TEJn5