Mac 安装 vuecli 报错

# 执行
npm install -g @vue/cli

# 抛出
npm ERR! code EACCES npm ERR! syscall access npm ERR! path /usr/local/lib/node_modules npm ERR! errno -13 npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules' npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] { npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path: '/usr/local/lib/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/huangdaxin/.npm/_logs/2020-09-27T07_27_25_902Z-debug.log

原因 :执行命令时没有获得管理员权限

解决方案:在命令行前加 sudo 获取管理员权限,输入管理员密码(当前用户密码,非 apple ID 密码)

# 执行
sudo npm install -g @vue/cli
原文地址:https://www.cnblogs.com/jerome92/p/13739930.html