npm ERR! code ENOTFOUND npm ERR! syscall getaddrinfonpm ERR! errno ENOTFOUND报错问题

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那么执行2,某一个返回不为null那么就执行下面对应的其中一个在去执行2)
npm config set proxy null
npm config set https-proxy null
2、执行:
 
npm config set registry https://registry.cnpmjs.org/


如果还是不行的话那么直接搜索:

直接修改npmrc文件。

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

复制下面代码把文件原来的代码删除掉,把下面代码粘贴上去保存,然后重新安装依赖就可以了

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

你可能感兴趣的:(npx,my-app,npm,前端,node.js)