在Mac OS 下 npm install 报权限不足的错误
错误如下:
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/@vue
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@vue'
npm ERR! [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@vue'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/lib/node_modules/@vue'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
解决办法:
sudo npm install -g @vue/cli-service-global --allow-root
然后提示输入密码,运行即可。特做笔记。