Create and run a vue project ①——environment construction

① Install node.js suitable for your own system.

Download address: https://nodejs.org/en/download

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:

②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.

③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.

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.

⑤ 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.

⑥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

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:

可以使用:npm info vue命令查询安装的vue信息

⑦安装脚手架。

使用:npm install vue-cli -g命令安装脚手架。

安装成功后可以使用vue -V命令查看到vue的版本。

如果提示“vue不是内部或外部命令,也不是可运行的程序或批处理文件”,可以尝试将命令行窗口重启,或检查环境变量的配置(第四步)。

至此,vue环境安装完成。

后续步骤

创建vue项目并运行的后续步骤,请阅读:http://t.csdn.cn/TEJn5

Guess you like

Origin blog.csdn.net/defined_/article/details/129700113