问题描述

安装 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版本了。

Logo

前往低代码交流专区

更多推荐