npm 使用私服
首先全局安装npm源管理工具nrm
npm install nrm -g
安装成功之后,输入命令nrm ls 查看可选的源
如果遇到如下错误
按照提示修改nrm中cli.js的第17行,并保存
代码
const NRMRC = path.join(process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'], '.nrmrc');
这样就可以执行nrm ls 查看已存在的源url了
添加自定义源
nrm add 自定义源名 源的url
例如:
nrm add custom http://xx.xx.xx.xx:6666/nexus/repository/npm-public/
然后使用添加的源custom
nrm use custom