You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[BUG] <EACCES permissions errors when installing packages, npm is trying to use /.npm as its cache directory, which typically requires root permission >
#7572
Closed
2 tasks done
kavana-14 opened this issue
May 30, 2024
· 4 comments
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /.npm
npm ERR! errno -13
npm ERR!
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR! sudo chown -R 1007390000:0 "/.npm"
npm ERR! Log files were not written due to an error writing to the directory: /.npm/_logs
npm ERR! You can rerun the command with --loglevel=verbose to see the logs in your terminal
Expected Behavior
The issue arises because npm is trying to use /.npm as its cache directory, which typically requires root permissions. I'm try to create a react app on openshift, but after deployment when I rsh into my container shell and execute the npm start command i'm getting the error /.npm EACCESS. How to solve it .
The npm cache directory is set to a location where the user has appropriate permissions, avoiding permission issues.
Steps To Reproduce
In this environment...
With this config...
Run '...'
See error...
Environment
npm: 9.5.1
Node.js: 18.16.0
OS Name: ubuntu 22.04
System Model Name: Windows 10
npm config:
$ npm config ls
; node bin location = /usr/local/bin/node; node version = v18.16.0; npm local prefix = /home/node/app; npm version = 9.5.1; cwd = /home/node/app; HOME = /; Run `npm config ls -l` to show all defaults
The text was updated successfully, but these errors were encountered:
@kavana-14 npm will have appropriate access if it got installed correctly. If you want to change location of cache you can use --cache flag in your command to specify different location for caching. Checkout https://docs.npmjs.com/cli/v10/using-npm/config#cache
also from error log you can try changing permission of that directory to fix.
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR! sudo chown -R 1007390000:0 "/.npm"
@milaninfy I tried to fix the issue from the error logs, included that command inside the Dockerfile, but got the issue as below,
Step 11/14 : RUN chown -R 1007390000:0 "/.npm"
---> Running in 6dbe5b2a8315
chown: cannot access '/.npm': No such file or directory
The command '/bin/sh -c chown -R 1007390000:0 "/.npm"' returned a non-zero code: 1
I logged into the container shell and check the existence of /.npm directory
$ ls -l /.npm
ls: cannot access '/.npm': No such file or directory
$
$ ls -l ~/.npm
ls: cannot access '//.npm': No such file or directory
> oc rsh client-56975c6c4-x454j
$ npm config get cache
/.npm
@kavana-14 What happens when you set cache to different location does it work for you ?, npm config set cache ./another/location or you can specify the cache in .npmrc.
@milaninfy, thank you, setting the cache to different location solved my issue, but the problem is with my browser. I can be able to expose the service and see the web page in my chrome but not possible in Internet Explorer.
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
Expected Behavior
The issue arises because npm is trying to use /.npm as its cache directory, which typically requires root permissions. I'm try to create a react app on openshift, but after deployment when I rsh into my container shell and execute the npm start command i'm getting the error /.npm EACCESS. How to solve it .
The npm cache directory is set to a location where the user has appropriate permissions, avoiding permission issues.
Steps To Reproduce
Environment
The text was updated successfully, but these errors were encountered: