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 now needs to re-enable every time upgrades node formula #198728

Open
4 tasks done
rinsuki opened this issue Nov 23, 2024 · 6 comments
Open
4 tasks done

corepack now needs to re-enable every time upgrades node formula #198728

rinsuki opened this issue Nov 23, 2024 · 6 comments
Labels
upstream issue An upstream issue report is needed

Comments

@rinsuki
Copy link
Contributor

rinsuki commented Nov 23, 2024

brew gist-logs <formula> link OR brew config AND brew doctor output

~ $ brew config
HOMEBREW_VERSION: 4.4.6
ORIGIN: https://github.com/Homebrew/brew
HEAD: cc0b5d6d05d1f3af5b2f53e9fbb1e7bfa0c332ab
Last commit: 6 days ago
Core tap JSON: 23 Nov 08:59 UTC
Core cask tap JSON: 23 Nov 08:59 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_EDITOR: nano
HOMEBREW_MAKE_JOBS: 10
Homebrew Ruby: 3.3.6 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.6/bin/ruby
CPU: 10-core 64-bit arm_firestorm_icestorm
Clang: 16.0.0 build 1600
Git: 2.39.5 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 15.1.1-arm64
CLT: 16.1.0.0.1.1729049160
Xcode: 16.1
Rosetta 2: false

~ $ brew doctor
Your system is ready to brew.

Verification

  • My brew doctor output says Your system is ready to brew. and am still able to reproduce my issue.
  • I ran brew update and am still able to reproduce my issue.
  • I have resolved all warnings from brew doctor and that did not fix my problem.
  • I searched for recent similar issues at https://github.com/Homebrew/homebrew-core/issues?q=is%3Aissue and found no duplicates.

What were you trying to do (and why)?

  • Install node
  • Run corepack enable
  • (wait until next node update)
  • brew upgrade

What happened (include all command output)?

after upgrade, /opt/homebrew/bin/pnpm will not work, since symblic link is depending to specific node version.

$ /opt/homebrew/bin/pnpm
zsh: no such file or directory: /opt/homebrew/bin/pnpm

$ ls -l /opt/homebrew/bin/pnpm
lrwxr-xr-x@ 1 user  admin  62 11 23 18:16 /opt/homebrew/bin/pnpm -> ../Cellar/node/23.2.0_1/lib/node_modules/corepack/dist/pnpm.js

What did you expect to happen?

binary created by corepack enable (e.g. yarn, pnpm, ...) should still work after upgrades node formula.

Step-by-step reproduction instructions (by running brew commands)

brew uninstall pnpm; brew uninstall node
# Install [email protected]_1 for upgrade
curl -LO https://github.com/Homebrew/homebrew-core/raw/a6cd670526b0b1b7abe7e2610fb55536ea712280/Formula/n/node.rb
brew install ./node.rb
corepack enable
brew upgrade
# Current node version is 23.3.0
pnpm version
# ... not working
@rinsuki rinsuki added the bug Reproducible Homebrew/homebrew-core bug label Nov 23, 2024
@SMillerDev
Copy link
Member

What creates those symlinks?

@rinsuki
Copy link
Contributor Author

rinsuki commented Nov 23, 2024

corepack enable creates it.

@SMillerDev
Copy link
Member

Then the corepack/node developers should probably fix that. All homebrew does is --enable-corepack when building node

@rinsuki
Copy link
Contributor Author

rinsuki commented Nov 24, 2024

But I think it is hard to tell corepack to use a permanent (symlink) path like /opt/homebrew/opt/node/... instead of real path /opt/homebrew/Cellar/node/<version>/..., without specific hack (in corepack) for Homebrew.

I think most good choice for corepack user is (re)split corepack formula from node and enables every binary in install phase.

(sorry for suddenly ping, but @ovflowd might be want to know this issue because of #193982 )

@ovflowd
Copy link

ovflowd commented Nov 24, 2024

Then the corepack/node developers should probably fix that. All homebrew does is --enable-corepack when building node

That only tells Node to bundle the corepack binary, but not enable corepack.

There isn't currently an environment variable to tell if corepack should be enabled, the corepack enable command must be executed.

Note that "corepack enable" is more about enabling corepack for X package managers (if no argument provided it does for all of them)

I do think it is a command you should run on every upgrade, as corepack also does certain checks regarding versioning of package managers.

@ovflowd
Copy link

ovflowd commented Nov 24, 2024

And yes, I agree that this isn't a Homebrew bug. Please report an issue on nodejs/node, I believe what you want is permanent corepack enablement even if Node.js version switches (i.e by some sort of .dotfile on home/profile folders idk)

@carlocab carlocab added upstream issue An upstream issue report is needed and removed bug Reproducible Homebrew/homebrew-core bug labels Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream issue An upstream issue report is needed
Projects
None yet
Development

No branches or pull requests

4 participants