The first lesson of VUE learning - Nodejs installation

First go to the official website to download, find a previous resource, and select the LTS long-term support version

Here I forgot to check it when I installed it, and I don’t know if there will be any problems in the future, so let’s leave it like this for now

The installation is successful, let's configure the environment

Description: The environment configuration mainly configures the path where the global module installed by npm is located, and the path of the cache cache. The reason to configure it is because it will be executed in the future: npm install express [-g] (the optional parameter -g , g stands for global installation), the installed module will be installed in the [C:\Users\username\AppData\Roaming\npm] path, occupying the C drive space.

For example: I want to put the path of all modules and the cache path in the folder where my node.js is installed, then create two folders [node_global] and [ node_cache] as shown below:

After creating two empty folders, open the cmd command window and enter

npm config set prefix "D:\ProgramFiles\Nodejs\Tools\node_global"

npm config set cache "D:\ProgramFiles\Nodejs\Tools\node_cache"

Once done we can type

npm config get prefix

npm config get cache

Next, set the environment variable, close the cmd window, "My Computer" - right click - "Properties" - "Advanced System Settings" - "Advanced" - "Environment Variables"

Add variables:

(1)

NODE_PATH

D:\ProgramFiles\Nodejs\Tools\node_global\node_modules

Here is the location of the file just created

(2)

Add %NODE_PATH% to path

(3)

There is a path with npm in the path in the above environment, change it to the one just created

D:\ProgramFiles\Nodejs\Tools\node_global

The environment variable is created

配置完后,安装个module测试下,我们就安装最常用的express模块,打开cmd窗口,

输入如下命令进行模块的全局安装:

npm install express -g # -g是全局安装的意思

(注意:执行的时候建议使用管理员权限打开CMD,否则有可能会提示权限不够报错)

四、配置淘宝镜像源

: npm install cnpm -g --registry=https://registry.npm.taobao.org

完成后,安装脚手架。

npm install -g @vue/cli

安装完成。

至此,npm配置算完成了,测试配置是否成功:打开cmd,输入node,回车,再输入require('cluster'),如果能正常输出cluster模块的信息,说明上面的所有配置就算生效了。

完成。

然后我跟着视频就开始创建项目了:

打开cmd,选择创建项目的过程:

输入 vue create springboot-vue-demo,然后进去

这里是保存配置,可以选择保存也可以选择不保存,然后运行就完成了。我就不运行了。

然后后面使用idea打开,关闭cmd。

选择这里

然后运行就行了。

加个 --open可以自动跳转浏览器。如果跳转的是0.0.0.0:8080的话就要更改一个配置

打开node_modules/@vue/cli-service/lib/commands/serve.js

即可。

Guess you like

Origin blog.csdn.net/Yafii/article/details/129697554