一、npm config set registry命令
npm config set registry命令用于设置npm的包注册表地址。
解决方案1:设置为官方npm仓库
npm config set registry https://registry.npmjs.org/
解决方案2:设置为淘宝npm镜像
npm config set registry https://registry.npmmirror.com/
解决方案3:查看当前配置的registry
npm config get registry
解决方案4:通过.npmrc文件配置
你可以在你的项目根目录或者用户的home目录下创建或修改.npmrc文件,然后写入下面的内容来设置registry:
registry=https://registry.npmmirror.com/
解决方案5:使用命令临时设置
你可以在执行npm命令时使用--registry选项来临时设置registry:
npm install package-name --registry=https://registry.npmmirror.com/
注意:请根据实际需求选择合适的registry地址,并替换上述命令中的package-name和https://registry.npmmirror.com/为你的实际需要安装的包和镜像地址。
二、本地如果已经有了:
.yarnrc中查看
registry "https://xxxx"
三、合成:
npm config set registry https://xxxx.abc.com
执行完会生成一个.npmrc文件;
内容:registry=https://xxxx.abc.com
2万+

被折叠的 条评论
为什么被折叠?



