Search code examples
node.jsexpressterminalcommandnodemon

When I try to install nodemon i get this error message


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:

Looks like the problem is with the package generator-karma, not sure if this is the problem or not.

Can anyone show me what i need to do to get this installing correctly.

Thanks Sanil


Solution

  • I believe you're trying to install a global package on your system by using npm install -g nodemon, then got permission denied, which is shown in error message.

    You can't install a global package without root permission. If you want to do so, just execute it with root permission, like using sudo: sudo npm i -g nodemon or switch to root then execute again.