[BUG] NPM crashes when no access to cache directory, but has access to registry. #6245
Closed
2 tasks done
Labels
Bug
thing that needs fixing
Needs Triage
needs review for next steps
Release 9.x
work is associated with a specific npm 9 release
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
This previous issue (#4996, fixed by #5197) is still relevant. If the npm cache directory is invalid (e.g.
/dummy
), but npm does not have access to the registry (behind proxy, or npm_config_offline=true), the ENOENT error is logged, but the app does not crash. If npm does have access to registry, it logs the error and then crashes.I am, additionally, curious why npm is connecting to the registry at all just because the default cache dir is restricted. I.e:
NODE_DEBUG=http
/dummy
) the node debug logs show that a GET request is being sent to registry.npmjs.orgExpected Behavior
NPM should not crash with an invalid cache-location just because it has access to the registry. This should, like in #5197, be logged silently as an error and not cause the program to crash.
Steps To Reproduce
npm_config_offline=true
, and it runs with the following output:Environment
/dummy
.The text was updated successfully, but these errors were encountered: