背景:
由于换电脑需要将开发环境重新安装一遍,再安装vue脚手架时,总是报错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.
大致意思就是说 当前用户的权限不够
于是需要切换到root权限,在这之前 自己了解过Linux的用户切换命令 sudo ,所以一直沿用了Linux中的语法,在mac中切换到root 权限的命令为 sudo su -
总结:
1.安装vue-cli需要root权限 不然会一直报错
2.知识是灵活变通的。