fix(doctor): skip npm audit when no package-lock.json in Hermes-managed install#39449
Closed
alaamohanad169-ship-it wants to merge 1 commit into
Closed
Conversation
On Windows native installs (and any Hermes-managed install where agent-browser is vendored without a package-lock.json), `hermes doctor` was reporting phantom 'X npm vulnerabilities' and telling users to run `npm audit fix` inside the Hermes-managed directory in %LOCALAPPDATA%. That fix path is un-actionable: - `npm audit fix` requires a lockfile to safely update - The path is Hermes-managed; users should not hand-edit it - Vulnerabilities in vendored deps are addressed by the Hermes release pipeline, not by individual user action Now doctor checks for package-lock.json before running the audit. When it's missing, the audit is skipped and three info lines explain: 1. why the audit was skipped (no package-lock.json) 2. that vulnerabilities are managed by the release pipeline 3. that users should not run `npm audit fix` inside that path Regression tests cover both the no-lockfile (skip) and lockfile-present (run normally) paths. Closes NousResearch#36893.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary\nWhen npm audit runs inside a Hermes-managed install that has node_modules but no package-lock.json (e.g. Windows native vendored installs), the audit itself works but the only safe remediation —
npm audit fix— cannot run without a lockfile. This PR skips the audit in that case and tells the user why.\n\nFixes #36893\n\n## Files changed\n-hermes_cli/doctor.py— skip check + informative messages\n-tests/hermes_cli/test_doctor.py— regression tests