nodejs / help

:sparkles: Need help with Node.js? File an Issue here. :rocket:
1.45k stars 278 forks source link

Unable to run `npm i` or even `sudo npm i` to install dependency due to OS. #4226

Closed zakhaev26 closed 2 months ago

zakhaev26 commented 1 year ago

Details

I have checked the Issue #3893 which was somewhat similar , but still facing Errors in installing dependencies.

logs

npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /home/mogulcoder26/Codes/jobsearch/node_modules/ajv
npm ERR! dest /home/mogulcoder26/Codes/jobsearch/node_modules/.ajv-xbedDMck
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, rename '/home/mogulcoder26/Codes/jobsearch/node_modules/ajv' -> '/home/mogulcoder26/Codes/jobsearch/node_modules/.ajv-xbedDMck'
npm ERR!  [Error: EACCES: permission denied, rename '/home/mogulcoder26/Codes/jobsearch/node_modules/ajv' -> '/home/mogulcoder26/Codes/jobsearch/node_modules/.ajv-xbedDMck'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'rename',
npm ERR!   path: '/home/mogulcoder26/Codes/jobsearch/node_modules/ajv',
npm ERR!   dest: '/home/mogulcoder26/Codes/jobsearch/node_modules/.ajv-xbedDMck'
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: /home/mogulcoder26/.npm/_logs/2023-08-18T18_51_07_392Z-debug-0.log

even on sudo command ,I m facing error as :

mogulcoder26@ETC1603046:~/Codes/jobsearch$ sudo npm i 
sudo: npm: command not found

Node.js version

20.3.0

Example code

Not applicable.

Operating system

Linux ETC1603046 4.4.0-17134-Microsoft #285-Microsoft Thu Aug 30 17:31:00 PST 2018 x86_64 x86_64 x86_64 GNU/Linux

Scope

Dependency Installation Issue

Module and version

Not applicable.

preveen-stack commented 1 year ago

are you using WSL on windows?

zakhaev26 commented 12 months ago

Yes.

Randomblock1 commented 11 months ago

You can use sudo -E to preserve environment variables. It looks like the root's PATH (executable search directory) doesn't include wherever node is, but the user's does. You could also just add node to the root path.

github-actions[bot] commented 3 months ago

It seems there has been no activity on this issue for a while, and it is being closed in 30 days. If you believe this issue should remain open, please leave a comment. If you need further assistance or have questions, you can also search for similar issues on Stack Overflow. Make sure to look at the README file for the most updated links.

github-actions[bot] commented 2 months ago

It seems there has been no activity on this issue for a while, and it is being closed. If you believe this issue should remain open, please leave a comment. If you need further assistance or have questions, you can also search for similar issues on Stack Overflow. Make sure to look at the README file for the most updated links.