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
{{ message }}
Repository navigation
[BUG] npm exits silently with the code 254 and read only filesystem #4838
I use npm 8.6.0 and when I exec into Kubernetes pod and run npm --version npm exits silently. Then running echo $? 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
Create a static pod in the Kubernetes cluster using the following yaml:
changed the title [-][BUG] npm refuses to run with read only root filesystem and exits silently with the code 254[/-][+][BUG] npm exits silently with the code 254 and read only filesystem[/+]on May 2, 2022
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 --max-logs=0. Please try this and see if it solves this issue.
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 --loglevel silly to see what happens? Usually a WARN message should happen:
$ 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!
Reacted by Jason Williams, Gerrit Kieffer, Aamir Shah and Dimitri KOPRIWA
Reacted by Luke Karrys, Jason Williams and Aamir Shah
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).
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 root by default, and a recent change to npm behavior causes it to run as the owner of the working directory when launched by root, but the host-OS user ID does not exist in the container, resulting in a read failure (triggering the above)
Reacted by Luke Karrys, Matt Hamann and Victor Andreescu
Activity
[-][BUG] npm refuses to run with read only root filesystem and exits silently with the code 254[/-][+][BUG] npm exits silently with the code 254 and read only filesystem[/+]wraithgar commentedon May 3, 2022
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
--max-logs=0. Please try this and see if it solves this issue.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
--loglevel sillyto see what happens? Usually aWARNmessage should happen:$ 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.0XhmikosR commentedon Jun 7, 2022
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!
darcyclarke commentedon Jun 7, 2022
@XhmikosR did you try @wraithgar's suggested fix?
whs commentedon Jun 8, 2022
Doesn't seems to do anything
jasonwilliams commentedon Jun 8, 2022
@wraithgar's fix didn't work for me I still get 254 just like @whs does. Node 18.1.0, npm 8.8.0
XhmikosR commentedon Jun 8, 2022
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).
2 remaining items
fix: don't fail immediately if cache dir is not accessible
fix: don't fail immediately if cache dir is not accessible
fix: don't fail immediately if cache dir is not accessible
fix: don't fail immediately if cache dir is not accessible
fix: don't fail immediately if cache dir is not accessible
fix: don't fail immediately if cache dir is not accessible
fix: don't fail immediately if cache dir is not accessible
fix: don't fail immediately if cache dir is not accessible (#5197)
thw0rted commentedon Jul 29, 2022
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
rootby default, and a recent change tonpmbehavior causes it to run as the owner of the working directory when launched by root, but the host-OS user ID does not exist in the container, resulting in a read failure (triggering the above)Create home dir for user pptr.
harness: managed adapter installs, bounded handshake, legible errors
harness: managed adapter installs, bounded handshake, legible errors
harness: managed adapter installs, bounded handshake, legible errors
harness: managed adapter installs, bounded handshake, legible errors