問題描述:使用 vue create a-test 命令創建項目一直卡着安裝依賴失敗,報錯:ERROR Failed to get response from https://registry.npm.taobao.org/binary-mirror-config,命令行出現如下信息:
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 https://registry.npm.taobao.org/binary-mirror-config
[#########.........] - 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