npm install 失败 无法连接 https://registry.npmjs.org

错误提示如下:

npm install -g @bchatard/alfred-jetbrains

npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/@bchatard%2falfred-jetbrains failed, reason: getaddrinfo ENOTFOUND registry.npmjs.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!     /Users/xiangrui/.npm/_logs/2020-01-04T17_28_43_142Z-debug.log

意思就是连接不上 https://registry.npmjs.org,在浏览器里访问这个网址果然访问不,是用手机访问 https://registry.npmjs.org 竟然可以访问,那么试着手机开个热点,电脑连上手机的网络,npm install -g @bchatard/alfred-jetbrains,成功了!
记得可以试试浏览器请求 https://registry.npmjs.org/

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。