mcya / JavaScriptExperience

👮 JavaScript Experience for web(JavaScript归类:简单入门+数组+经典循环+字符串+函数+Date日期+简单对象+BOM+DOM) +[ Issues(js实用技巧)]
29 stars 8 forks source link

Mac npm install -g vue-cli 报错解决 #27

Open mcya opened 6 years ago

mcya commented 6 years ago

问题描述

MAC安装vue的时候发现报错了,如下:


npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen) npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules npm ERR! path /usr/local/lib/node_modules npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall access 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! stack: '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! Please try running this command again as root/Administrator.

npm ERR! A complete log of this run can be found in:


解决方案:添加文件夹权限,即sudo chown -R $USER /usr/local

  • 在终端执行sudo chown -R $USER /usr/local这个命令给这个文件夹加权限就行了

总结

关于Mac的很多问题的解决方式都是:给对应的文件加上权限

mcya commented 6 years ago

https://blog.csdn.net/genius_yym/article/details/80970830