Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

corepack not installed by default with Homebrew #55366

Closed
karlhorky opened this issue Oct 12, 2024 · 4 comments
Closed

corepack not installed by default with Homebrew #55366

karlhorky opened this issue Oct 12, 2024 · 4 comments
Labels
wrong repo Issues that should be opened in another repository.

Comments

@karlhorky
Copy link
Contributor

karlhorky commented Oct 12, 2024

Version

v22.9.0

Platform

Darwin Karls-MBP.local 24.0.0 Darwin Kernel Version 24.0.0: Tue Sep 24 23:36:26 PDT 2024; root:xnu-11215.1.12~1/RELEASE_ARM64_T8103 arm64

Subsystem

No response

What steps will reproduce the bug?

  1. brew install node@22 (on macOS, with @22 version specifier recommended on download page, screenshot below)
  2. corepack enable (as in the Corepack docs page)
  3. 💥 zsh: command not found: corepack

Screenshot 2024-10-12 at 16 00 30

This also reproduces with no version specifier (brew install node)

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior? Why is that the expected behavior?

corepack is installed and on PATH

What do you see instead?

corepack is not installed

Additional information

Encountering this bug, I thought that the decision had been made to remove Corepack from Node.js, as is being discussed in various PRs and issues:

@karlhorky
Copy link
Contributor Author

karlhorky commented Oct 12, 2024

Further Background

After doing a bit of research in the Homebrew repository, I can see the following:

  1. This seems to be caused by the --without-corepack flag in the node.rb Formula
    1. https://github.com/Homebrew/homebrew-core/blob/33b4fac1a0ff77debe83de6f692fcc0c9ed7d6cf/Formula/n/node.rb#L70
  2. Homebrew team member @cho-m recommends usage of Homebrew to install Corepack separately with brew install corepack (which would mean the version number is managed by Homebrew). An exception is made for old versions such as node@20, node@18, etc, where the --without-corepack is not present
    1. corepack not installed with formula node Homebrew/homebrew-core#151439 (comment)
    2. This means that the Homebrew behavior will be different for different versions:
      1. node@22: corepack not installed
      2. node@20 and older: corepack installed
  3. The --without-corepack flag was first added in a PR for Node.js 17.3.0, involved Homebrew members @chenrui333 @carlocab @SMillerDev @bevanjkay
    1. node 17.3.0 Homebrew/homebrew-core#91540
    2. The original reason was "Tests are failing at the moment because of a symlink collision with corepack.", so seems like a Homebrew CI problem

Maybe this should instead be considered a bug in the Homebrew formula? (at least, from the perspective of the Node.js team).

If I can get confirmation that this is considered a bug from the Node.js team, I will report a new separate issue in the Homebrew repository.

@RedYetiDev
Copy link
Member

RedYetiDev commented Oct 12, 2024

Homebrew is compiling Node.js without corepack, hence it not being installed. That's certainly not an issue with Node.js, no?

Report issues with the homebrew binary to homebrew.

@RedYetiDev RedYetiDev closed this as not planned Won't fix, can't repro, duplicate, stale Oct 12, 2024
@RedYetiDev RedYetiDev added the wrong repo Issues that should be opened in another repository. label Oct 12, 2024
@karlhorky
Copy link
Contributor Author

karlhorky commented Oct 12, 2024

Homebrew is compiling Node.js without corepack, hence it not being installed. That's certainly not an issue with Node.js, no?

It's an issue with the Node.js Download docs, which recommend installing via Homebrew in two divergent ways:

  • brew install node@22: corepack not installed
  • brew install node@20 and older: corepack installed

This divergent behavior is a pretty confusing situation for users who are following official Node.js documentation.

If Node.js wants to support Homebrew, and Homebrew has divergent behavior, then the Node.js Download page should add an additional command for the latest Node.js version (so that Corepack is also installed there):

+brew install corepack

Looks like a new PR should be done over here, in case Homebrew does not accept the issue below (which is likely, given historical responses to this issue):

https://github.com/nodejs/nodejs.org/blob/3c0635cfcbdc667b3e7daae5f2bedf1e58a7d486/apps/site/util/getNodeDownloadSnippet.ts#L69-L83

Report issues with the homebrew binary to homebrew.

Makes sense, reported again here:

@karlhorky
Copy link
Contributor Author

If Node.js wants to support Homebrew, and Homebrew has divergent behavior, then the Node.js Download page should add an additional command for the latest Node.js version (so that Corepack is also installed there):

+brew install corepack

Looks like a new PR should be done over here, in case Homebrew does not accept the issue below (which is likely, given historical responses to this issue):

nodejs/nodejs.org@3c0635c/apps/site/util/getNodeDownloadSnippet.ts#L69-L83

Since this was a pretty small PR, I opened it here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wrong repo Issues that should be opened in another repository.
Projects
None yet
Development

No branches or pull requests

2 participants