Cannot install nodemon: Error: EACCESS:permission denied

Asked 2 years ago, Updated 2 years ago, 91 views

Cannot install nodemon.How can I install it?

By the way, the npm version is 5.6.0.

hattiorunoMBP:~hattoriakitsugu$npm install nodemon-g
npm WARN checkPermissions Missing write access to /Users/hattoriakitsugu/.npm-global/lib/node_modules/nodemon
npm ERR!path/Users/hattoriakitsugu/.npm-global/lib/node_modules/nodemon
npm ERR!code EACCES
npm ERR!errno-13
npm ERR!syscall access
npm ERR!Error: EACCESS:permission denied, access '/Users/hattoriakitsugu/.npm-global/lib/node_modules/nodemon'
npm ERR!{Error:EACCESS:permission denied, access'/Users/hattoriakitsugu/.npm-global/lib/node_modules/nodemon'
npm ERR!stack: 'Error: EACCESS:permission denied, access\'/Users/hattoriakitsugu/.npm-global/lib/node_modules/nodemon\',
npm ERR!errno: -13,
npm ERR!code: 'EACCESS',
npm ERR!syscall: 'access',
npm ERR!path: '/Users/hattoriakitsugu/.npm-global/lib/node_modules/nodemon'}
US>npm ERR!
US>npm ERR! Please try running this command again as root/Administrator.

US>npm ERR!A complete log of this run can be found in:
npm ERR!/Users/hattoriakitsugu/.npm/_logs\2018-05-20T00_03_54_549Z-debug.log

error log

In addition, the sudo command did not work.

hattiorunoMBP:~hattoriakitsugu$sudonpm install nodemon-g
Password:
/Users/hattoriakitsugu/.npm-global/bin/nodemon->/Users/hattoriakitsugu/.npm-global/lib/node_modules/nodemon/bin/nodemon.js

>[email protected] postinstall/Users/hattoriakitsugu/.npm-global/lib/node_modules/nodemon
>node bin/postinstall||exit0

Love nodemon? You can now support the project via the open collective:
 >https://opencollective.com/nodemon/donate

+ [email protected]
updated 1 package in 7.455s

Logs using sudo

node.js

2022-09-30 15:31

2 Answers

Please try running this command again as root/Administrator.

Try running the installation command with administrator privileges, as shown in .

$sudonpm install nodemon-g


2022-09-30 15:31

Because of a permission error or EACCESS error, the problem itself is that you cannot access the directory or file where the npm module will be stored, so as the error message states, if you run it with administrator privileges with sudo for the time being.This means sudonpm install~.

Personally, however, I don't think this is a fundamental solution.This is because the permission error is directly under my home directory, so I think it would be better if I could access it without sudo.I think it's not a problem specific to nodemon, but rather a problem derived from the configuration when installing npm.

If it is still preferable to install without sudo, the official document "How to Prevent Permissions Errors" will be helpful.According to this, you have the following options:

  • Select 1: Reinstall npm using Node Version Manager (nvm)
  • Changes the default directory for Option 2:npm

In the case of macOS, you may also have the option of reinstalling using brewAnyway, ~/.npm-global/ I just want to fix the following permissions, so manually chown might work.


2022-09-30 15:31

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.