Home > Software engineering >  Why cannot i download nodemon?
Why cannot i download nodemon?

Time:12-04

I am trying to download nodemon and am quite unsure why it is not downloading. I have got the following error?

npm install -g nodemon

npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/nodemon
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/nodemon'
npm ERR!  [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/nodemon'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/usr/local/lib/node_modules/nodemon'
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/ryandevasia/.npm/_logs/2021-12-04T05_47_29_366Z-debug.log

What must be done to download the module?

CodePudding user response:

The EACCES error means that npm does not have permissions to install global packages. To do this, you'll need to run the command as root (which has permission for the npm global directory) with sudo. So you can run sudo npm install -g nodemon with an administrator account and it will work, after you enter your password.

CodePudding user response:

Try installing with sudo:

sudo npm install -g nodemon

Usually it's better to install nodemon as a dev dependency with

npm i -d nodemon

That way you can build it into your scripts and it helps with collaboration:

"start" : "nodemon index.js"
  • Related