fix(staged): run doctor checks with shell env snapshots - #852
Conversation
Signed-off-by: Matt Toohey <contact@matttoohey.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d0bee2bb2e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
| if matches!( | ||
| upper_key.as_str(), | ||
| "NPM_CONFIG_PREFIX" | "NPM_CONFIG_CACHE" | "COREPACK_HOME" |
There was a problem hiding this comment.
When a user's shell intentionally exports NPM_CONFIG_PREFIX to a user-writable global prefix (for example ~/.npm-global), this sanitizer drops it before run_doctor_fix/run_doctor_update executes npm install -g .... I confirmed npm treats that env var as the global prefix (NPM_CONFIG_PREFIX=/tmp/x npm prefix -g returns /tmp/x), so these doctor fixes/updates will run against npm's default prefix instead, often failing due to permissions or installing a duplicate outside the PATH that doctor just resolved.
Useful? React with 👍 / 👎.
Summary