问题描述:使用 vue create a-test 命令创建项目一直卡着安装依赖失败,报错:ERROR Failed to get response from registry.npm.taobao.org/binary-mirr… ,命令行出现如下信息:
Failed to check for updates ✨ Creating project in E:\work\a-test123. 🗃 Initializing git repository... ⚙️ Installing CLI plugins. This might take a while...
ERROR Failed to get response from registry.npm.taobao.org/binary-mirr… [#########.........] - idealTree:@types/webpack-sources: sill fetch manifest picomatch@^2.0.4
vue-cli版本:v4.5.15、v4.5.12
问题原因:vue-cli 4.xx 版本后默认启用了淘宝镜像源,而npm的镜像源不是淘宝的(npm config get registry命令可以查看npm镜像源)
解决办法:修改全局的.vuerc文件的useTaobaoRegistry为false即可
.vuerc文件所在位置:
- Windows系统:C盘下的用户目录,如:C:\Users\xxx
- MacOS系统:home目录下,如:/home/xxx