npm相关操作

时间:2022-07-23
本文章向大家介绍npm相关操作,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

操作环境: windows10 ,NodeJS v8.3.0,NPM v5.3.0

1.查看基本配置

npm config list

图片.png

2.查看完整配置

npm config ls -l

图片.png

3.代理

代理地址以自己为主

配置:npm config set proxy=http://127.0.0.1:1080
删除:npm config delete proxy

4.镜像地址registry

配置:npm config set registry= http://registry.cnpmjs.org
删除:npm config delete registry

5.node-sass、electron 和 phantomjs安装缓慢

https://github.com/lmk123/blog/issues/28

6.安装sha错误

  • 删除node_modules
  • npm cache clean --force
  • npm cache verify 查看是否清理

7.使用nrm管理镜像地址

npm install -g nrm