尝试全局安装nodemon,虽然已安装,但在尝试在终端中运行nodemon app.js
时(使用zsh),我收到了权限错误。以下错误:
/usr/local/lib/node_modules/nodemon/node_modules/configstore/index.js:53
throw err;
^
Error: EACCES: permission denied, open '/Users/carlosgrijalva/.config/configstore/update-notifier-nodemon.json'
You don't have access to this file.
at Error (native)
at Object.fs.openSync (fs.js:641:18)
at Object.fs.readFileSync (fs.js:509:33)
at Object.get (/usr/local/lib/node_modules/nodemon/node_modules/configstore/index.js:34:26)
at Object.Configstore (/usr/local/lib/node_modules/nodemon/node_modules/configstore/index.js:27:44)
at new UpdateNotifier (/usr/local/lib/node_modules/nodemon/node_modules/update-notifier/index.js:34:17)
at module.exports (/usr/local/lib/node_modules/nodemon/node_modules/update-notifier/index.js:123:23)
at Object.<anonymous> (/usr/local/lib/node_modules/nodemon/bin/nodemon.js:15:27)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
我发现了这篇文章:https://docs.npmjs.com/getting-started/fixing-npm-permissions
按照选项1中的说明运行以下命令:
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
我正在讨论重新安装节点,因为我正在使用6.11并且认为我不妨使用最新版本,但我不确定这是否是最明智的举措。如果有人有任何其他建议,我真的很感激。