1

So today is a Monday, that's for sure. allllllll that I did was run the command $ sudo rm -r node_modules/ package-lock.json and then from there I went to run the command $ npm i to reinstall the dependencies. From there I got the error saying that I don't have permission:

npm ERR! path /Users/c.francia/Desktop/application/app/node_modules/@types
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/Users/c.francia/Desktop/application/app/node_modules/@types'
npm ERR!  [Error: EACCES: permission denied, access '/Users/c.francia/Desktop/application/app/node_modules/@types'] {
npm ERR!   stack: "Error: EACCES: permission denied, access '/Users/c.francia/Desktop/application/app/node_modules/@types'",
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/Users/c.francia/Desktop/application/app/node_modules/@types'
npm ERR! }

I tried the command sudo chown -R $(whoami) ~/.npm that was suggested and widely accepted here and also tried $ sudo chown -R $USER /usr/local/lib/node_modules as suggested here I had this error before but the first solution resolved it for me. So I have no idea what has changed from removing node_modules and the package-lock.json file

Ctfrancia
  • 1,248
  • 1
  • 15
  • 39

1 Answers1

0

If the first solution worked for you, then the permissions in .npm were not set correctly. Now that your permissions are resolved, try to avoid using sudo with npm commands in the future.

joshwilsonvu
  • 2,569
  • 9
  • 20