如何解决live-server 不会在 Mac BigSur 上全局安装
我全新的 Mac Air 无法在全球范围内安装 live-server
。不过,在我出厂重置 Mac 后,它一直抛出相同的错误。
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.
我尝试在 root
上再次重新安装,但它引发了此错误
gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/var/root/Library/Caches/node-gyp/14.17.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/live-server/node_modules/fsevents/.node-gyp"
gyp WARN install got an error,rolling back install
gyp WARN install got an error,rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied,mkdir '/usr/local/lib/node_modules/live-server/node_modules/fsevents/.node-gyp'
gyp ERR! System Darwin 20.5.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/live-server/node_modules/fsevents
gyp ERR! node -v v14.17.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
+ live-server@1.2.1
如何在我的 Mac 上全局安装 live-server
?
解决方法
看起来错误是因为脚本没有访问 /var
的权限。
您是否尝试过使用 sudo
进行安装?
sudo npm install -g live-server
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。