npm安装报错整理 npm ERR! network proxy config is set properly See npm help config getaddrinfo EN

写在开头:在公司使用npm安装总是卡住,跟着网上查看了很多资料,乱乱的。强迫整理下以后观看

npm config set registry https://registry.npm.taobao.org // 先叫神龙
1
这些都不行的话,就是你网的问题了,哈哈哈哈哈哈,1、连手机wifi(估计也不行,你那就是信号不行,)2、就是靠网线的,不行就让人有网线的帮你开个热点时事

1、安装不行问题
(1) 先试试 vsc 和 cmd 指令都可以不
(2) 确定公司没有代理 ,执行:
解决办法: [原文链接](https://www.jianshu.com/p/3fd7d90db01a)

1、执行:

npm config get proxy
npm config get https-proxy
如果返回值不为null,继续执行:
(这一步很重要,一定要保证两个命令的返回值都为null,话说回来,应该出现这个错误这两个返回值有不为null的)
npm config set proxy null
npm config set https-proxy null
2、执行:
npm config set registry http://registry.cnpmjs.org/

3、愉快的下载了:npm install -g cnpm --registry=https://registry.npm.taobao.org
1
2
3
4
5
6
7
8
9
10
11
12
13
14
(3)配置公司ip,先上链接原文链接
设置代理
npm config set proxy=http://127.0.0.1:8087
npm config set registry=http://registry.npmjs.org
1
2
关于https
经过上面设置使用了http开头的源,因此不需要设https_proxy了,否则还要增加一句:

npm config set https-proxy http://server:port
1
代理用户名和密码
npm config set proxy http://username:password@server:port
npm confit set https-proxy http://username:password@server:port
1
2
取消代理
npm config delete proxy
npm config delete https-proxy
1
2
还有配置镜像,这个还没有看,所以小字解释,先上链接原文链接
配置镜像
(1)by config command

npm config set registry http://registry.cnpmjs.org
npm info underscore (如果上面配置正确这个命令会有字符串response)
1
2
(2)命令行指定

npm --registry http://registry.cnpmjs.org info underscore
1
(3)编辑 ~/.npmrc 加入下面内容

registry = http://registry.cnpmjs.org
1

————————————————
版权声明:本文为CSDN博主「我说她是我的她」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_45351419/article/details/106134969

posted @ 2021-04-13 15:38  浮山山主  阅读(1256)  评论(0编辑  收藏  举报