我无法安装 nodemon 包

I am not able to install nodemon package

无法安装 nodemon 包,这里是错误消息。

npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
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.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/atulyadav/.npm/_logs/2021-08-31T18_23_33_532Z-debug.log
(base) atulyadav@ATULs-MacBook-Pro my-express-server % 

你可以做两件事

  1. 更改 /usr/local/lib/node_modules 文件夹或
  2. 的权限
  3. 尝试sudo npm install nodemon - g

使用 sudo npm install nodemon -g ,这应该可以解决问题。

注意:它会提示您输入密码,您可能看不到正在输入的“字母”,但请继续输入并按回车键。