zl程序教程

您现在的位置是:首页 >  其他

当前栏目

npm安装依赖报错npm ERR! code ENOTFOUND npm ERR! errno ENOTFOUND

安装npmcode依赖 报错 ERR Errno
2023-09-14 09:09:24 时间

npm安装依赖报错
使用npm安装一个依赖包时报错,报错内容如下:

[root@D20L42 qtone-resource-fe]# npm install -g cnpm --registry=https://registry.npm.taobao.org 
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npm.taobao.org/cnpm failed, reason: getaddrinfo ENOTFOUND registry.npm.taobao.org registry.npm.taobao.org:443
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!     /root/.npm/_logs/2021-06-15T05_39_54_815Z-debug.log

解决方法:

npm config get proxy
npm config get https-proxy
npm config set proxy null
npm config set https-proxy null
npm config set registry http://registry.cnpmjs.org/

再次安装依赖就不会报错了

npm install -g cnpm --registry=https://registry.npm.taobao.org