deepthan / blog-angular

Angular 笔记
280 stars 58 forks source link

关于npm的错误 #134

Open deepthan opened 3 years ago

deepthan commented 3 years ago

关于npm的错误解决办法

npm 连接错误或者设置了代理

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i"
npm ERR! node v7.7.1
npm ERR! npm  v4.1.2
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! syscall read

npm ERR! network read ECONNRESET
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is 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'

其实是版本不支持了,直接更新版本:

window + r
cmd 
cnpm install npm@latest -g

npm使用方法:

npm config set registry http://registry.npmjs.org/
npm config rm proxy
npm cache clean

下载文件出现 ‘Unexpected end of JSON’

Unexpected end of JSON input while parsing near '...,"dist":{"shasum":"49'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Program Files\nodejs\node_cache\_logs\2017-09-26T14_37_55_039Z-debug.log

运行如下代码删除缓存

npm cache clean --force
或
npm cache clean 

npm 下载包和删除包

npm uninstall --save @angular