执行npm install -g @vue/cli时报错:This is a problem related to network connectivity

执行npm install -g @vue/cli时报错

npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! network 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 ERR! A complete log of this run can be found in:
npm ERR!     D:\app\nodejs\node_cache\_logs\2023-02-27T07_01_05_797Z-debug.log

解决办法:

1. 执行如下命令 代理置为空

npm config set proxy null 

2. 运行如下命令清理缓存

npm cache clean --force

3. 配置npm源

npm config set registry https://registry.npmmirror.com

4. 再次执行安装命令

你可能感兴趣的:(安装报错,npm,vue.js,前端)