Loading... 本篇文章记录一下用macOS搭建HEXO遇到的坑 执行 ``` npm install hexo-cli -g ``` 的时候报错 ``` npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli/node_modules/chokidar npm ERR! code EACCES npm ERR! syscall access npm ERR! path /usr/local/lib/node_modules/hexo-cli npm ERR! errno -13 npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/hexo-cli' npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/hexo-cli'] { npm ERR! stack: "Error: EACCES: permission denied, access '/usr/local/lib/node_modules/hexo-cli'", npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path: '/usr/local/lib/node_modules/hexo-cli' 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/yuanyi/.npm/_logs/2019-10-30T11_43_55_100Z-debug.log ``` 原因是`/usr/local/lib/node_modules`文件夹没有权限 执行 ``` sudo chown -R `whoami` /usr/local/lib/node_modules ``` 然后再执行 ``` npm install hexo-cli -g ``` 如果还报错error 17就执行 ``` sudo npm install --unsafe-perm --verbose -g hexo ``` 最后修改:2022 年 04 月 18 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 0 如果觉得我的文章对你有用,请随意赞赏