-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Using --reinstall-packages-from
installs/enables Corepack
#3544
Comments
Do note that nvm is not supported when installed via homebrew; please brew remove it and install it with the install script instead. All nvm does is Certainly nvm could, like npm itself, omit it from the list of reinstalled packages, but then that would break someone who wants corepack installed globally. Had you previously enabled corepack on v20.17.0? |
TIL, thanks
Yes I assume that something about the install is what actually enables it, but I wanted to call it out as a separate bullet point.
No I haven't enabled Corepack on 20.17.0. Hm, I was under the impression that Corepack is only meant to be bundled with Node.js. However, I checked the Corepack docs and they do mention instructions to install it separately if you wish. I am not aware of any way you could differentiate between a bundled Corepack and a separately-installed Corepack. IMO, the current negative behavior outweighs the edge case if someone manually installed Corepack. |
hmm - i use i do see that |
ok, so the issue is that Unfortunately I don't see any easy way to determine if corepack is enabled or not, which would let me match that status from the source node version. |
Yeah, I looked into that too. I think you could infer if Corepack is enabled by checking if its symlinks are present, but that seems a little messy.
I think filtering it might be a better idea, because otherwise you risk actually installing an unexpected (potentially incompatible) version of Corepack with Node.js. Maybe it would be good enough to simply filter and warn the user? Something like "Global installation of Corepack is detected but has been skipped". I don't know how many people realistically have a non-standard version of Corepack installed, but I can imagine this is a very small edge case... |
I agree, I'm just going to filter. If I get complaints, then I can warn when corepack is being filtered, and/or I can ask the corepack folks to provide a way to solve the problem. |
New Stuff - `install.sh`: add `$ZDOTDIR` to zsh search (#3458) Fixes - `reinstall-packages`: do not reinstall corepack (#3544) - avoid bash-specific syntax (#3499) - `install-latest-npm`: npm v11 is out - `nvm_install_latest_npm`: avoid unbound variable (#3447) - give a more helpful message when `lts` alias is mistakenly used (#3441) - `nvm ls`, `nvm alias`, `nvm install`: error when an LTS name is invalid - `nvm_normalize_lts`: error when an LTS name is not lowercase (#3417) Documentation - [readme] update link - [readme] fix `--no-use` example (#3479) - [readme] update copyright notice (#3507) - [readme] note zsh-nvm's AUTO_USE option (#2670) - [readme] add note about reloading zshrc after editing (#3052) - [readme] Update shell profile file install notes (#2241) - [readme] add docker tips (#2318) - [readme] remove `avn` from readme (#3469) - [readme] fnm -> nvm.fish (#2541) Refactors - prefer `case` over if/else chains - combine `sed -e` invocations/arguments Tests - `nvm exec`/`nvm run`: add `--silent` tests (#1259) - [actions] release test needs git tags - migrate `installation_iojs` test suite to GitHub Actions (#3476) - Migrate slow test suite from Travis CI (#3470) - temporarily skip this failing travis test to unblock progress - [actions] TOC: use latest LTS node - `install.sh`: clean up `nvm_detect_profile` tests - `nvm_detect_profile`: refactor (#3467) - run urchin tests on pull requests (#3466) - update mocks - ensure that unit tests use only mocked LTS names - [actions] use `node/install` instead of `node/run` Meta - disable blank issues - update issue template - add DCO (#3456) - Rename .github/ISSUE_TEMPLATE.md to .github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md (#3454)
Operating system and version:
nvm debug
output:nvm ls
output:How did you install
nvm
?What steps did you perform?
Background info: Corepack is bundled with all Node.js versions since 14.9.0/16.9.0, but it is supposed to be disabled by default.
I installed Node.js 22.14.0 using the
--reinstall-packages-from=default
argument:My previous default was 20.17.0, so it had Corepack bundled, but Corepack was disabled.
What happened?
Node.js 22.14.0 got installed correctly, but it has Corepack enabled unexpectedly. I only noticed because my
yarn
commands started adding a "packageManager" field to my package.json file, which is an indicator that Corepack is enabled (see nodejs/corepack#485).I verified that Corepack is enabled by listing the files in my Node.js bin directory:
From what I can tell, the
--reinstall-packages-from
argument treats Corepack as a globally-installed package (since it's in the globalnode_modules
directory, I presume). When you use nvm to install a new version of Node.js, it installs and enables Corepack (regardless of whether Corepack was enabled or not).After I used
corepack disable
to disable Corepack, the symlinks are gone:However, the problem is not just that Corepack is enabled unexpectedly -- it has been reinstalled, overriding the version of Corepack that is supposed to be bundled with this version of Node.js. For example, using the steps listed above, my local installation of Node.js is using Corepack v0.29.3 when it is supposed to be using v0.31.0.
This behavior is an even bigger problem when you try to install an older version of Node.js that is incompatible with the newer version of Corepack.
What did you expect to happen?
--reinstall-packages-from
argument should not reinstall Corepack.--reinstall-packages-from
argument should not enable Corepack either.Is there anything in any of your profile files that modifies the
PATH
?.zshrc
:The text was updated successfully, but these errors were encountered: