









// 配置全局的 npm 镜像源, 如下,设置使用淘宝镜像源
npm config set registry https://registry.npm.taobao.org
// 安装 <pkg> 时,使用淘宝镜像源
npm install <pkg> --registry=https://npm.taobao.org
// <xxx>域的包,使用此镜像源进行安装
@xxx:registry=https://registry-npm.rd.xxx.com
// 其它的包,使用此镜像进行安装
registry=https://registry.npmjs.org
// package.json
"xxx-upload-map-plugin": "https://registry.npmjs.org/xxx-upload-map-plugin/-/xxx-upload-map-plugin-0.1.33.tgz"
在package.json文件中,添加publishConfig属性,这样可以指定npm源发布仓库(可以用于公司的npm私库)需要提前登录
"publishConfig": {
"registry": "http://xxxxx/"
}
在一个含有 package.json 的文件夹下,执行 npm install(注:不带参数),
将会安装 package.json 中 dependencies 指定的包,如果有 package-lock.json 或 npm-shrinkwrap.json,则此两者优先级较高:
npm-shrinkwrap.json > package-lock.json > package.json
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。