npm ERR!无法安装任何包的解决办法

日志报错:

1087 verbose stack Error: getaddrinfo ENOTFOUND xn--rvg xn--rvg:80
1087 verbose stack     at errnoException (dns.js:27:10)
1087 verbose stack     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:78:26)
1088 verbose cwd E:\wzdsvn\web\redux\react-redux
1089 error Windows_NT 6.1.7601
1090 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
1091 error node v4.4.3
1092 error npm  v2.15.1
1093 error code ENOTFOUND
1094 error errno ENOTFOUND
1095 error syscall getaddrinfo
1096 error network getaddrinfo ENOTFOUND xn--rvg xn--rvg:80
1096 error network This is most likely not a problem with npm itself
1096 error network and is related to network connectivity.
1096 error network In most cases you are behind a proxy or have bad network settings.
1096 error network
1096 error network If you are behind a proxy, please make sure that the
1096 error network 'proxy' config is set properly.  See: 'npm help config'
1097 verbose exit [ 1, true ]

或者是无论怎么样fetch请求都是400或者400,或者最后报错err:E404之类的,总之从svn或者别的地方下载的项目如果没有依赖,自己又安装不成功的时候可以参考下面的解决方法,我的就是这样好的。
解决办法:

1、执行:

npm config get proxy
npm config get https-proxy
如果返回值不为null,继续执行:
npm config set proxy null
npm config set https-proxy null
2、执行:
npm config set registry http://registry.cnpmjs.org/
3、直接编辑c盘下的.npmrc文件,将registry的值修改为:
registry = http://registry.cnpmjs.org

参考:

http://stackoverflow.com/questions/20397883/npm-doesnt-install-any-modules-network-socket-hangs-up (需要注意registry的值为:http://registry.cnpmjs.org)
http://www.daliane.com/npm_err_wu_fa_an_zhuang_ren_he_bao_de_jie_jue_ban_fa/

ps:建议直接执行第2种或第三种方法应该就可以了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值