my npm -g works perfectly but i really dont know why my local npm doesn't work
npm ERR! code EACCES
npm ERR! syscall open
npm ERR! path /home/user/express/todoapp-api/package-lock.json
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, open '/home/user/express/todoapp-api/package-lock.json'
npm ERR! [Error: EACCES: permission denied, open '/home/user/express/todoapp-api/package-lock.json'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'open',
npm ERR! path: '/home/user/express/todoapp-api/package-lock.json'
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! /home/user/.npm/_logs/2022-04-16T09_47_36_160Z-debug-0.log
permissions
drwxrwxr-x 7 user user 4096 Apr 16 11:44 .
drwxrwxr-x 5 user user 4096 Apr 16 11:30 ..
-rw-rw-r-- 1 user user 417 Apr 16 12:20 app.js
drwxr-xr-x 2 user user 4096 Apr 16 11:15 bin
drwxrwxr-x 2 user user 4096 Apr 16 11:46 config
drwxrwxr-x 2 user user 4096 Apr 16 11:24 models
drwxr-xr-x 64 user user 4096 Apr 16 12:41 node_modules
-rw-rw-r-- 1 user user 271 Apr 16 12:21 package.json
-rw-r--r-- 1 root root 38736 Apr 16 12:21 package-lock.json
drwxr-xr-x 2 user user 4096 Apr 16 11:27 routes
is it a must that package-lock.json require root previledges??
npm install
should still work because the lock file should be read and not written during that operation. – Indirectionsudo npm install
at some point before this. – Streptokinase