今天 npm 下载报的错整理如下
一 npm ERR! code E400
下载nrm
nrm ls
nrm use cnpm
nrm use npm
二 npm ERR! code E404
查看
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 config get registry
https://registry.npm.taobao.org
npm config set registry https://registry.npmjs.org
三 【npm ERR! Unexpected end of JSON input while parsing near ‘…sh_time":141072930277’】
1.直接执行 npm cache clean --force, 如果执行成功,再npm install即可。
2.如果执行失败,请先升级npm,即npm i -g npm, 最后再执行npm cache clean --force, 最后再npm install.
3.如果还执行失败,那就先npm cache verify,再npm cache clean --force,最后再npm install。
4.如果还是执行失败,那么恭喜你,跟我一样了。我也是这样走到这一步的。那就往复的执行 【先npm cache clean --force再npm install】,一直到npm cache clean --force执行成功即可,然后npm install即成功。我前后往复执行了三次才成功!骚年,加油!
转载自mcya