Skip to content

Commit f53feda

Browse files
committed
Update nodejs.md
1 parent b4a0673 commit f53feda

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

docs/note/site/nodejs.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,16 @@ cache=D:\nodejs\node_cache
8484
和上面配置全局路径一样,我们可以直接用命令
8585

8686
````shell
87+
npm install -g cnpm --registry=https://registry.npm.taobao.org
88+
// 有时候这样仍然会失败,镜像并没有改变,可使用下面这条命令修改
8789
npm config set registry=http://registry.npm.taobao.org
8890
````
8991

9092
或者修改npmrc文件,添加参数
9193

92-
`registry=http://registry.npm.taobao.org`
94+
````shell
95+
registry=http://registry.npm.taobao.org
96+
````
9397

9498
设置完可以用命令`npm config list` 查看配置参数
9599

@@ -178,6 +182,28 @@ current: {"os":"win32","arch":"x64"}
178182
- 输入命令行 `nvm use 版本号`(例如:nvm use 12.17.0)即可选择你本地所使用的Node.js版本,使用此命令行可以根据你自己的需要随意切换node.js版本运行;
179183
- 输入命令行 `nvm list` 查看你安装的所有**node.js**版本号,以及你当前所选择的node.js运行版本;
180184
- 如果想删除某**node.js**版本的话,输入命令行 `nvm uninstall 版本号`(例如:nvm use 12.17.0)即可删除对应版本。
185+
- 设置nvm镜像,提高下载速度。**切记结尾有斜杠
186+
187+
```c++
188+
nvm node_mirror http://npm.taobao.org/mirrors/node/
189+
nvm npm_mirror https://npm.taobao.org/mirrors/npm/
190+
```
191+
192+
- 或者修改nvm安装目录下的setting.txt文件,在文件中加入
193+
194+
```c++
195+
node_mirror: http://npm.taobao.org/mirrors/node/npm_mirror: https://npm.taobao.org/mirrors/npm/
196+
```
197+
198+
mac 和 linux 版 nvm 就没有 node_mirror & npm_mirror 命令 😂 ,设置下载 node 镜像地址的方式是
199+
200+
```
201+
export NVM_NODEJS_ORG_MIRROR=https://nodejs.org/dist
202+
```
203+
204+
将等号后面地址换成淘宝镜像([https://npm.taobao.org/mirrors/node](https://npm.taobao.org/mirrors/node/))就可以了 😄 [详见➡️](https://github.com/creationix/nvm#listing-versions)
205+
206+
>>>>>>> 288ee7c5e17b2e2e128bcabe0f44ce456c12d006
181207
182208
### 缓存问题
183209

@@ -322,3 +348,5 @@ windows系统node升级:https://www.jianshu.com/p/0f3fdf6c0d5f
322348

323349
windows如何把已安装的nodejs高版本降级为低版本(图文教程):https://www.jb51.net/article/202124.htm
324350

351+
nvm 设置下载 node 的镜像地址 :https://github.com/xhlwill/blog/issues/7
352+

0 commit comments

Comments
 (0)