Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: EACCES: permission denied, mkdir when installing sth with npm

Tags:

node.js

npm

Everytime I try to install something with npm (in this case electron-packager) I run into this error. How can I solve this issue?

I have already tried to give me access by changing the permissions on .npm via chmod, but it didn't work and I also tried it with another node version (installed via nvm: node -v 12.1.0; npm -v 6.9.0) and it didn`t work as well.

$ npm install electron-packager --save-dev
npm ERR! path /Users/felixmoser/.npm/_cacache/index-v5/15/a0
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir
npm ERR! Error: EACCES: permission denied, mkdir '/Users/felixmoser/.npm/_cacache/index-v5/15/a0'
npm ERR!  [OperationalError: EACCES: permission denied, mkdir '/Users/felixmoser/.npm/_cacache/index-v5/15/a0'] {
npm ERR!   cause: [Error: EACCES: permission denied, mkdir '/Users/felixmoser/.npm/_cacache/index-v5/15/a0'] {
npm ERR!     errno: -13,
npm ERR!     code: 'EACCES',
npm ERR!     syscall: 'mkdir',
npm ERR!     path: '/Users/felixmoser/.npm/_cacache/index-v5/15/a0'
npm ERR!   },
npm ERR!   isOperational: true,
npm ERR!   stack: 'Error: EACCES: permission denied, mkdir ' +
npm ERR!     "'/Users/felixmoser/.npm/_cacache/index-v5/15/a0'",
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/Users/felixmoser/.npm/_cacache/index-v5/15/a0',
npm ERR!   parent: 'electron-packager'
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 (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/felixmoser/.npm/_logs/2019-05-01T14_11_08_530Z-debug.log

I actually don't know what else I should try now and hope, that you guys can help me solve this problem!

like image 969
Felix Moser Avatar asked Jan 02 '23 00:01

Felix Moser


1 Answers

change the ownership of .npm folder, In my case I couldn't figure out the solution so I used

sudo chown -R $(whoami) ~/.npm
like image 155
MD SHAYON Avatar answered Jan 03 '23 14:01

MD SHAYON