nodejs(nodejs)

### 项目初始化

`npm init`

`npm init -y`

### 安装项目依赖(包)
`npm install`
`npm install 包名 --save`
`npm install 包名 -g`
`npm install 包名@版本号`

`npm update ...`   <!-- /*同上*/ -->

`npm uninstall 包名 -g`<!--   -g删全局的 -->

开发环境配置

这里的环境配置主要配置的是npm安装的全局模块所在的路径,以及缓存cache的路径,之所以要配置,是因为以后在执行类似:npm install express [-g] (后面的可选参数-g,g代表global全局安装的意思)的安装语句时,会将安装的模块安装到【C:\Users\用户名\AppData\Roaming\npm】路径中,占C盘空间。以下仅作参考:

1.在F:\SP\node新建一个文件夹,名称为node_global2.在F:\SP\node新建一个文件夹,名称为node_cache3.如果你是zip安装直接接着往下走,如果你是msi安装方式,请直接到第五步;4.配置npm系统环境path变量**“我的电脑”-右键-“属性”-“高级系统设置”-“高级”-“环境变量”-“path”**,如图;5.创建完两个空文件夹之后,打开cmd命令窗口,输入;6.npm config set prefix “F:\SP\node\node_global”;7.npm config set cache “F:\SP\node\node_cache”;8.“我的电脑”-右键-“属性”-“高级系统设置”-“高级”-“环境变量”;9.在【系统变量】下新建【NODE_PATH】,输入【F:\SP\node\node_global\node_modules10.将【用户变量】下的【Path】修改为【F:\SP\node\node_global】原文链接:https://blog.csdn.net/alnorthword/article/details/88420874

————————
### 项目初始化

`npm init`

`npm init -y`

### 安装项目依赖(包)
`npm install`
`npm install 包名 --save`
`npm install 包名 -g`
`npm install 包名@版本号`

`npm update ...`   <!-- /*同上*/ -->

`npm uninstall 包名 -g`<!--   -g删全局的 -->

< strong > development environment configuration < / strong >

The environment configuration here mainly configures the path of the global module installed by NPM and the path of the cache. It is necessary to configure it because the installed module will be installed to [C: \ users \ user name \ appdata \ roaming \ NPM] when executing the installation statement similar to: NPM install express [- g] (the following optional parameter – G, G represents the meaning of global global installation) The path occupies Disk C space. The following are for reference only:

1. Create a new folder named node in F: \ sp \ node_ Global2. Create a new folder named node in F: \ sp \ node_ Cache3. If you are installing in zip, go straight ahead. If you are installing in MSI, go directly to step 5; 4. Configure NPM system environment path variable * * my computer – right click – properties – advanced system settings – Advanced – environment variable – path * *, as shown in the figure; 5. After creating two empty folders, open the CMD command window and enter; 6.npm config set prefix “F:\SP\node\node_global”; 7.npm config set cache “F:\SP\node\node_cache”; 8. My computer – right click – properties – advanced system settings – Advanced – environment variables; 9. Create a new [node_path] under [system variable] and enter [F: \ sp \ node \ node_global \ node_modules10]. Modify the [path] under [user variable] to [F: \ sp \ node \ node_global] original link: https://blog.csdn.net/alnorthword/article/details/88420874