npm config set registry命令

 

一、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
————————————————

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

原文链接:https://blog.csdn.net/opentogether/article/details/141610926

 

 

https://registry.npmjs.org
npm config set registry http://172.16.92.8:8081/repository/npm-public

posted @ 2025-04-19 18:33  三瑞  阅读(1733)  评论(0)    收藏  举报