3

I just got a new Mac laptop. To be honest, I am not very familiar with the Mac operating system. Now I am having a problem running npm install. I tried to solve the problem by running this command following this link, Permission denied when installing npm modules in OSX. I could get into next step. Now the error is withing the project folder. Basically, it does not have the permission to the node_modules of the project folder which is on the desktop. When I run npm install again, I got this error.

npm ERR! path /Users/wai/Desktop/easy-eat-backend-laravel/node_modules/@coreui/coreui/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/Users/wai/Desktop/easy-eat-backend-laravel/node_modules/@coreui/coreui/node_modules'
npm ERR!  { [Error: EACCES: permission denied, access '/Users/wai/Desktop/easy-eat-backend-laravel/node_modules/@coreui/coreui/node_modules']
npm ERR!   stack:
npm ERR!    'Error: EACCES: permission denied, access \'/Users/wai/Desktop/easy-eat-backend-laravel/node_modules/@coreui/coreui/node_modules\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path:
npm ERR!    '/Users/wai/Desktop/easy-eat-backend-laravel/node_modules/@coreui/coreui/node_modules' }
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! 

I already updated the permission on the npm folder. What else do I have to do to sovle this error?

Wai Yan Hein
  • 13,651
  • 35
  • 180
  • 372
  • I have the same error. Try this: https://stackoverflow.com/questions/51967335/npm-install-permission-denied-macos this didn't work for me. – Olli Jun 09 '19 at 22:48

2 Answers2

2

just uninstall the existed node, and use brew install node.

1. sudo rm -rf  /usr/local/lib/node_modules/npm/
2. brew doctor
3. brew cleanup --prune-prefix ( or sudo rm -f /usr/local/include/node)
4. brew install node

Hope the above will help you

Brook
  • 109
  • 1
  • 7
-7

Just use sudo npm install.

That should do it

  • 3
    Thank you for your answer, however by using sudo, this exposes the user to unnecessary risk, and only perpetuates the permissions problems the asker is facing; the result will be that more folders/files will now be unnecessarily owned by root. – Brenton Fletcher Nov 13 '20 at 06:47