一个 Node.js 项目中,如果同时出现需要2个及2个以上的镜像安装依赖包,该怎么办?
添加 .npmrc 文件,指定默认的镜像,同时根据 scope(@xxx/xxx)指定需要的镜像。(注释用 #)
registry=https://registry.npmjs.org/
@vue:registry=https://registry.npm.taobao.org
@nuxt:registry=https://registry.npm.taobao.org
# other
对于在 .npmrc 无法单独配置的,也可以修改 package.json 中依赖包的值,指定从哪里下载安装
{
"dependencies": {
"xxx": "https://registry.npmjs.org/xxx/-/xxx-4.18.2.tgz"
}
}
以上文为例,https://registry.npmjs.org/xxx/-/xxx-4.18.2.tgz 这样的地址,在 node_modules 中,找到同名的 xxx 文件夹,xxx/package.json 中,有一个 _resolved 属性,这就是需要设置的值。
node-sass 安装失败的问题吗,访问 blog.csdn.net/kDevelop/ar…