npm ERR network Invalid response body while trying to fetch
问题描述安装 vue/cli 的时候持续报错:npm noticenpm notice New minor version of npm available! 8.5.0 -> 8.7.0npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.7.0npm notice Run npm install -g npm@8
·
问题描述
安装 vue/cli 的时候持续报错:
npm notice
npm notice New minor version of npm available! 8.5.0 -> 8.7.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.7.0
npm notice Run npm install -g npm@8.7.0 to update!
npm notice
npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! errno ERR_SOCKET_TIMEOUT
npm ERR! network Invalid response body while trying to fetch https://registry.npmjs.org/depd: Socket timeout
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安装源头就好了
解决方案:
1. 通过 config 命令切换源
npm config set registry https://registry.npm.taobao.org
npm info underscore (如果上面配置正确这个命令会有字符串response)
2. 命令行指定
npm --registry https://registry.npm.taobao.org info underscore
3. 安装vue
npm i -g @vue/cli
输入 vue --version 查看是否成功:
如果还不行,可能你需要升级自己node.js版本了。
更多推荐
已为社区贡献1条内容
所有评论(0)