npm全称Node Package Manager,是node.js的模块依赖管理工具。由于npm的源在国外,所以国内用户使用起来各种不方便。
- npm镜像的 切换
查看当前库:npm config get registry
或者 npm get registry
设置官方库:npm config set registry https://registry.npmjs.org
设置淘宝镜像:npm config set registry https://registry.npm.taobao.org/
- npm配置文件:
npm配置文件在这里
C:\Users[用户名].npmrc
- 报错的问题:eg:
// .............
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\Sany\Desktop\mp-qian\marketplace-v2\node_modules\.staging\fsevents-ea85ce14\node_modules\yallist\package.json'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\Sany\Desktop\mp-qian\marketplace-v2\node_modules\.staging\fsevents-ea85ce14\node_modules\yallist\README.md'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\Sany\Desktop\mp-qian\marketplace-v2\node_modules\.staging\fsevents-ea85ce14\node_modules\yallist\yallist.js'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Sany\AppData\Roaming\npm-cache\_logs\2018-12-11T11_40_34_702Z-debug.log
npm install
报错:就是因为镜像的问题,我修改为官网镜像,npm install
的时候,就不报错了!
注:saas项目在npm install的时候,提示什么python,gyp等什么的错误信息,也是镜像的问题!!!