关闭

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

标签: npm
15619人阅读 评论(0) 收藏 举报
分类:

日志报错:

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 ]

解决办法:

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种或第三种方法应该就可以了


1
1

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:43697次
    • 积分:524
    • 等级:
    • 排名:千里之外
    • 原创:12篇
    • 转载:14篇
    • 译文:0篇
    • 评论:1条