npm安装依赖包报错,npm ERR! code ENOTFOUND(2020-07-03)

 

vue项目安装依赖包,报错如下:

$ npm install
npm WARN registry Using stale data from https://registry.npmjs.org/ because the host is inaccessible -- are you offline?
npm WARN registry Using stale data from https://registry.npmjs.org/ due to a request error during revalidation.
npm WARN deprecated [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/vue-router/-/vue-router-3.3.4.tgz failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.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!     /Users/luminal/.npm/_logs/2020-07-03T04_12_04_809Z-debug.log

解决方式:

$ npm config get proxy
null
$ npm config get https-proxy
null

$ 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
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
/Users/luminal/.nvm/versions/node/v10.16.0/bin/cnpm -> /Users/luminal/.nvm/versions/node/v10.16.0/lib/node_modules/cnpm/bin/cnpm
+ [email protected]
updated 5 packages in 12.316s

$ cnpm i
bash: cnpm: command not found
$ cnpm install
bash: cnpm: command not found
$ nvm use v10.16.0
Now using node v10.16.0 (npm v6.9.0)
$ cnpm i
⠧ [6/23] Installing uniqs@^2.0.0
WARN node unsupported "[email protected]" is incompatible with [email protected][email protected][email protected] › watchpack-chokidar2@^2.0.0, expected node@<8.10.0
✔ Installed 23 packages
✔ Linked 750 latest versions

之前使用 nvm 对 node 版本进行了管理,需要指定一下版本:nvm use v10.16.0

而后使用 cnpm i 或 cnpm install

 

参考链接:

npm安装任何包都报错的解决办法

 

 

 

你可能感兴趣的:(错误累积(错题本))