-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] npm exits silently with the code 254 and read only filesystem #4838
Comments
npm logging was changed recently to open the logfile early and stream to it, rather than wait for errors. To disable this completely use the flag The logging code is supposed to gracefully handle this situation but it appears to not be doing so in your case. Can you also try running with $ npm -v
npm WARN logfile could not be created: Error: EACCES: permission denied, open '/Users/wraithgar/.npm/_logs/2022-05-03T20_27_46_794Z-debug-0.log'
8.8.0 |
I'm also hitting this. Indeed, the issue happens only in docker. I had to pin down the Node.js image to v16.15.0 which ships with npm v8.5.5, but using Node.js v16.15.1 with npm v8.5.5 also worked fine. I also tried npm v8.12.1 and the same error happens. If someone could look into it, I'd really appreciate it! |
@XhmikosR did you try @wraithgar's suggested fix? |
Doesn't seems to do anything
|
@wraithgar's fix didn't work for me I still get 254 just like @whs does. Node 18.1.0, npm 8.8.0 |
OK, so this very weird. I just tried it today and it works in most projects except for the ones we have npm install warnings which seem to be now errors with the new version. I'll give it a go again, but I could reproduce the failure in 4 separate machines yesterday. I'll try to pinpoint the failure and see if the npm peer dependencies issues are now errors instead of warnings (the repos are Angular apps which have the issue #3666). |
We just hit this as well. Had to pin Node.js to v16.15.0 so we get npm v8.5.5. This is a critical issue given that it's strongly recommended to run production workloads on a read-only filesystem. |
Fixing to npm 8.5.5 is a no-go for us in light of CVE-2022-29244. |
This also changes all the log messages about not being able to create initial directories and files to `log.verbose` since we know run those commands on init. There are a lot of valid reasons why those might fail, and we don't want to show a warning for them every time. Fixes: #4769 Fixes: #4838 Fixes: #4996
This also changes all the log messages about not being able to create initial directories and files to `log.verbose` since we know run those commands on init. There are a lot of valid reasons why those might fail, and we don't want to show a warning for them every time. Fixes: #4769 Fixes: #4838 Fixes: #4996
This also changes all the log messages about not being able to create initial directories and files to `log.verbose` since we know run those commands on init. There are a lot of valid reasons why those might fail, and we don't want to show a warning for them every time. Fixes: #4769 Fixes: #4838 Fixes: #4996
This also changes all the log messages about not being able to create initial directories and files to `log.verbose` since we know run those commands on init. There are a lot of valid reasons why those might fail, and we don't want to show a warning for them every time. Fixes: #4769 Fixes: #4838 Fixes: #4996
This also changes all the log messages about not being able to create initial directories and files to `log.verbose` since we know run those commands on init. There are a lot of valid reasons why those might fail, and we don't want to show a warning for them every time. Fixes: #4769 Fixes: #4838 Fixes: #4996
This also changes all the log messages about not being able to create initial directories and files to `log.verbose` since we know run those commands on init. There are a lot of valid reasons why those might fail, and we don't want to show a warning for them every time. Fixes: #4769 Fixes: #4838 Fixes: #4996
This also changes all the log messages about not being able to create initial directories and files to `log.verbose` since we know run those commands on init. There are a lot of valid reasons why those might fail, and we don't want to show a warning for them every time. Fixes: #4769 Fixes: #4838 Fixes: #4996
This also changes all the log messages about not being able to create initial directories and files to `log.verbose` since we know run those commands on init. There are a lot of valid reasons why those might fail, and we don't want to show a warning for them every time. Fixes: #4769 Fixes: #4838 Fixes: #4996
Just to close the loop for anyone who was watching this, the root cause was #4996 -- failed to output a useful message when denied permission to open a log and the reason people encountered it in Docker was nodejs/docker-node#1734 -- image runs as |
Running npm (ex npm test, or npx {script}) resulted in an error about not being able to write to log files. Apparently this was introduced at some point by an npm update. The reson for the error was that the default location for the loga files is ~/.npm, but since the pptr user did not have a home directory, the log files could not be created. To fix this, the pptr user now has a home directory. npm/cli#4838 (comment)
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
I use npm 8.6.0 and when I exec into Kubernetes pod and run
npm --version
npm exits silently. Then runningecho $?
prints 254. It used to work fine with npm 8.5.5, read only file system and mentioned below security context config.Expected Behavior
I expect that
npm --version
will run fine.Steps To Reproduce
kubectl exec -it <pod_name> -- /bin/sh
npm --version
Environment
The text was updated successfully, but these errors were encountered: