转:https://blog.csdn.net/weng423811758/article/details/51537594

PS F:\LargeFrontEnd\vue-admin> npm install
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to http://registry.npm.taobao.org/axios failed, reason: getaddrinfo ENOTFOUND registry.npm.taobao.org
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network ‘proxy’ config is set properly. See: ‘npm help config’

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache_logs\2020-03-19T07_07_53_654Z-debug.log

解决办法:

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

Logo

前往低代码交流专区

更多推荐