Vue CLI 的包名称由 vue-cli 改成了 @vue/cli,所以想升级新版本,但是升级前需要删除之前的vue-cli,但是执行npm uninstall vue-cli -g删除时会得到一下错误信息
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules/vue-cli/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/vue-cli/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/vue-cli/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules/vue-cli/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/wangbl/.npm/_logs/2020-06-23T00_29_54_605Z-debug.log
提示是权限不足
这时我们需要在我们的命令前面加上sudo。
sudo npm uninstall vue-cli -g
系统输入管理员密码,然后完成删除工作。
为什么用sudo命令呢?因为sudo是linux系统管理指令,是允许系统管理员让普通用户执行一些或者全部的root命令的一个工具。当然你也可以直接用root用户执行删除,这时候就不用sudo命令了,但是mac系统的root用户默认情况下是处于停用状态,需要自己去启用root用户,这样看来sudo命令更方便一些。
参考文档:
https://www.jianshu.com/p/a2ef1f4c4080
https://blog.csdn.net/yao_yu_126/article/details/18614397#:~:text=sudo%E6%98%AFlinux%E7%B3%BB%E7%BB%9F%E7%AE%A1%E7%90%86,%E4%B9%9F%E6%8F%90%E9%AB%98%E4%BA%86%E5%AE%89%E5%85%A8%E6%80%A7%E3%80%82
https://support.apple.com/zh-cn/HT204012
网友评论