1. 先去官网下载解压版

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

win10 npm解压版安装

2. 解压完后先在目录下新建两个目录

node_global : npm 全局安装位置

node_cache : npm 缓存路径

win10 npm解压版安装

3. 把node路径和node_global路径复制下,添加到PATH环境变量里保存好

win10 npm解压版安装

4. 打开cmd输入nmp -v , node -v 出版本号就行了

然后再设置下全局安装目录和缓存目录,路径自改

npm config set prefix "E:\node-v12.18.0-win-x64\node_global"
npm config set cache "E:\node-v12.18.0-win-x64\node_cache"

5. 设置淘宝镜像cnpm,以下两个都可以

1. 直接指定registry为淘宝镜像
npm config set registry https://registry.npm.taobao.org
然后若需要安装gulp和less,可以直接用npm install gulp less --save-dev,就是从taobao镜像拿包了

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

输入上述命令即可安装,另外要注意的是,安装完后,输入cnpm -v进行检测,有问题需要检查下node_global这块的问题和上述步骤有没有不一样

转自:https://blog.csdn.net/idiot_qi/article/details/106608233

 

相关文章:

  • 2021-11-13
  • 2021-07-20
  • 2021-05-30
  • 2021-06-24
  • 2022-12-23
  • 2022-01-16
猜你喜欢
  • 2021-12-12
  • 2021-12-11
  • 2021-11-06
  • 2021-06-21
  • 2021-11-28
相关资源
相似解决方案