Skip to content

Fix npm bundle dump PATH#22332

Merged
MikeMcQuaid merged 1 commit into
mainfrom
fix-bundle-npm-node-path
May 18, 2026
Merged

Fix npm bundle dump PATH#22332
MikeMcQuaid merged 1 commit into
mainfrom
fix-bundle-npm-node-path

Conversation

@MikeMcQuaid
Copy link
Copy Markdown
Member

@MikeMcQuaid MikeMcQuaid commented May 18, 2026

  • Ensure npm list runs with npm's directory on PATH.
  • This lets /usr/bin/env node resolve Homebrew's node.
  • Add a regression for absolute npm shims.

Fixes #22331


  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them? Performance claims (e.g. "this is faster") must include Hyperfine benchmarks.
  • Have you written new tests (excluding integration tests) for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes. Non-maintainers may only have one AI-assisted/generated PR open at a time.

OpenAI Codex 5.5 xhigh with manual review and testing.


- Ensure `npm list` runs with npm's directory on `PATH`.
- This lets `/usr/bin/env node` resolve Homebrew's `node`.
- Add a regression for absolute npm shims.
Copilot AI review requested due to automatic review settings May 18, 2026 07:26
@MikeMcQuaid MikeMcQuaid enabled auto-merge May 18, 2026 07:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes brew bundle dump for npm packages by ensuring npm list is executed with the npm executable’s directory prepended to PATH, allowing /usr/bin/env node to resolve Homebrew’s node when npm is invoked via an absolute shim.

Changes:

  • Wrap the npm list -g --json invocation in with_env(package_manager_env(npm)) so PATH includes the npm directory.
  • Add an RSpec regression test asserting npm’s directory is placed at the front of PATH during package listing.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
Library/Homebrew/bundle/extensions/npm.rb Ensures npm list runs under a PATH that includes the npm executable’s directory.
Library/Homebrew/test/bundle/npm_spec.rb Adds a regression test validating PATH behavior for absolute npm shims during dumping.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue May 18, 2026
Merged via the queue into main with commit 54ab415 May 18, 2026
42 checks passed
@MikeMcQuaid MikeMcQuaid deleted the fix-bundle-npm-node-path branch May 18, 2026 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[brew bundle] Missing NPM packages - env: node: No such file or directory

3 participants