记录初次使用vue cli3.x创建项目遇到的一些问题
vue cli的官方文档:https://cli.vuejs.org/zh/guide/installation.html
一共两个步骤,安装vue cli和创建项目,分别对应以下两个命令:
npm install --global @vue/cli
vue create hello-world
1 安装vue cli 3.x,nodejs版本推荐 8.11.0+
2 运行 安装命令,出现 operation not permitted 错误,这是因为需要管理员权限运行安装命令
3 运行 创建项目 命令时,出现 ERROR command failed: npm install --loglevel error 错误,详细信息如下:
Vue CLI v3.4.1
✨ Creating project in F:\myFE\vue\task01\todo-list.
⚙ Installing CLI plugins. This might take a while...
npm ERR! Unexpected end of JSON input while parsing near '...ish_time":144557585
25'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\yourname\AppData\Roaming\npm-cache\_logs\2019-02-26T09_32_19_
331Z-debug.log
ERROR command failed: npm install --loglevel error
搜索了一下,发现了https://github.com/vuejs/vue-cli/issues/889
但是查看自己的~/.vuerc,里面本来就是false,"useTaobaoRegistry": false,不能解决我的问题。
我在命令终端输入nrm ls,查看当前使用的registry,显示使用的taobao
F:\myFE\vue\task01>nrm ls
npm ---- https://registry.npmjs.org/
cnpm --- http://r.cnpmjs.org/
* taobao - https://registry.npm.taobao.org/
nj ----- https://registry.nodejitsu.com/
rednpm - http://registry.mirror.cqupt.edu.cn/
npmMirror https://skimdb.npmjs.com/registry/
edunpm - http://registry.enpmjs.org/
这两者矛盾(自己的理解),于是使用 nrm use npm 改成默认的库,成功解决这个问题!