我重新安装了Mac OS Catalina,但不允许我安装npm应用程序。我尝试了sudo和non sudo。
npm install --global browser-sync
但出现此错误
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/browser-sync
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules/browser-sync
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/browser-sync'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/browser-sync'] {
npm ERR! stack: "Error: EACCES: permission denied, access '/usr/local/lib/node_modules/browser-sync'",
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules/browser-sync'
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/nicholasdixon/.npm/_logs/2019-12-14T07_09_23_421Z-debug.log
答案 0 :(得分:1)
重新安装操作系统是UNIX问题。
您可以通过在终端中输入以下内容进行修复:
sudo chown -R $USER /usr/local/lib/node_modules
这对我有用,希望对您也一样。