之前都可以用vue-ui证明自己的cli早都不是vue-cli
现在安装是@vue/cli
先卸载vue-cli旧的 npm uninstall -g vue-cli
然后安版本4:
npm install -g @vue/cli
但遇到permission
报错用 加 sudo
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
sudo npm install --g @vue/cli
如果又错❌
我最开始用淘宝镜像,安到最后成片的英文,最后看到了个【taobao】 【500】!证明服务器不行!
于是我换了镜像,没用淘宝了,
(参考https://blog.csdn.net/weixin_36185028/article/details/90513961)
npm config set registry https://registry.npmjs.org/
换成这个npmjs镜像,又试上面sudo,
如果又报错❌【exist已经有啦,什么delete删不了啊】
npm ERR! code EEXIST
npm ERR! path /usr/local/lib/node_modules/@vue/cli/node_modules/_jscodeshift@0.7.0@jscodeshift/node_modules/@babel/preset-env/node_modules/.bin/browserslist
npm ERR! Refusing to delete /usr/local/lib/node_modules/@vue/cli/node_modules/_jscodeshift@0.7.0@jscodeshift/node_modules/@babel/preset-env/node_modules/.bin/browserslist: containing path /usr/local/lib/node_modules/@vue/cli/node_modules/_jscodeshift@0.7.0@jscodeshift/node_modules/@babel/preset-env/node_modules/browserslist isn't under npm's control
npm ERR! File exists: /usr/local/lib/node_modules/@vue/cli/node_modules/_jscodeshift@0.7.0@jscodeshift/node_modules/@babel/preset-env/node_modules/.bin/browserslist
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
直接去删 @vue!!
mac路径有坑⚠️
npm ERR! path /usr/local/bin/vue
可是我的bin下面根本就没有@vue!
然后我看报错有一段
/usr/local/bin/vue ->/usr/local/lib/node_modules/@vue/cli/bin/vue.js
所以我就去lib里面看,然后@vue就在那里, 果断删!!!
再sudo npm install -g @vue/cli
新的@vue就有了,那个就是最新版本的!
虽然还要爆一大堆ERR!但试了试vue --version
就是4.3.1了