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
When the npm CLI encounters an EACCES error due to a permissions issue, as shown below,
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /tmp/foo/bar/_cacache/tmp
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 1000:1000 "/tmp/foo/bar"
npm ERR! Log files were not written due to an error writing to the directory: /tmp/foo/bar/_logs
npm ERR! You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
the process invoked by npm becomes an orphan.
For instance, if npm start launches a daemon program, like an Express app, and npm terminates due to the same error, the npm process will exit with status 243, but the daemon program remains active.
1714922 pts/7 S 0:00 sh -c node --expose-gc app
1714923 pts/7 Rl 0:00 \_ node --expose-gc app
Screencast.from.12-01-2023.02_32_38.AM.mp4
Is this behavior intentional?
Expected Behavior
The invoked process by npm dies as well.
Steps To Reproduce
Run npm with an inaccessible cache directory, for example, by using the nobody user or specifying an inaccessible directory for the cache parameter in .npmrc.
Execute npm-related tasks.
I have created an example repository to facilitate easier reproduction. The Dockerfile outlines the environment and sets up a reproducible playground.
; "user" config from /home/user/.npmrccache = "/tmp/inaccessible/.npm"; node bin location = /usr/local/bin/node; node version = v20.10.0; npm local prefix = /home/user/npm-orphan-example; npm version = 10.2.4; cwd = /home/user/npm-orphan-example; HOME = /home/user; Run `npm config ls -l` to show all defaults.
The text was updated successfully, but these errors were encountered:
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
When the npm CLI encounters an
EACCES
error due to a permissions issue, as shown below,the process invoked by npm becomes an orphan.
For instance, if
npm start
launches a daemon program, like an Express app, and npm terminates due to the same error, the npm process will exit with status243
, but the daemon program remains active.The process tree initially looks like this:
becomes
Screencast.from.12-01-2023.02_32_38.AM.mp4
Is this behavior intentional?
Expected Behavior
The invoked process by npm dies as well.
Steps To Reproduce
I have created an example repository to facilitate easier reproduction. The Dockerfile outlines the environment and sets up a reproducible playground.
https://github.com/moznion/npm-orphan-example
Environment
Linux 868d0296baea 6.2.0-37-generic #38~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov 2 18:01:13 UTC 2 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: