使用vue-cli创建项目时报错 command failed:npm install --loglevel error

使用vue-cli创建项目

vue create vuecli-demo
报错信息如下:
Vue CLI v4.5.4
Creating project in E:\Workspaces\vue\vuecli-demo.
Installing CLI plugins. This might take a while…

npm ERR! Unexpected end of JSON input while parsing near ‘…0ac15102a",“size”:100’

npm ERR! A complete log of this run can be found in:
npm ERR! D:\node-v12.18.3-win-x64\node-cache_logs\2020-09-14T02_27_53_457Z-debug.log
ERROR command failed: npm install --loglevel error
使用vue-cli创建项目时报错 command failed:npm install --loglevel error

解决办法

打开C:\Users\owner\.vuerc
是个隐藏文件,如果大家没有找到的话需要先设置操作系统能够显示隐藏文件

方法是 打开控制面板 文件夹选项 查看 显示隐藏文件
修改文件内容

{
“useTaobaoRegistry”: false,
“latestVersion”: “4.5.6”,
“lastChecked”: 1600050075404
}

useTaobaoRegistry 原先是true 改为false

然后重新创建 vue create vuecli-demo
即可成功,亲测有效!