npm ERR! code ENOTFOUND
npm ERR! syscall getaddrinfo
npm ERR! errno ENOTFOUND
npm ERR! network request to http://registry.cnpmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz failed, reason: getaddrinfo ENOTFOUND registry.cnpmjs.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'

根据网上搜的解决方法:

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 https://registry.cnpmjs.org/

试了一下我的还是不行,然后又搜别的方法:

直接修改npmrc文件,就是npm的配置文件所在位置。

因为是隐藏文件,直接搜索文件即可

 打开修改该文件即可:

http-proxy=http://proxyhost/:proxyport
strict-ssl=false
registry=https://registry.npmjs.org/

然后重新安装依赖就可以了

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐