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

[Feature Request] Persist "corepack enable" across Node versions #2898

Closed
noahnu opened this issue Sep 29, 2022 · 2 comments
Closed

[Feature Request] Persist "corepack enable" across Node versions #2898

noahnu opened this issue Sep 29, 2022 · 2 comments
Labels
feature requests I want a new feature in nvm!

Comments

@noahnu
Copy link

noahnu commented Sep 29, 2022

(Skipping the PR template since this is a feature request rather than a bug report.)

Feature Request

I use corepack in all my projects. corepack ships with Node by default however since it's experimental, it is still opt-in. To opt-in, you need to run corepack enable once on a fresh node install.

When installing a new version of Node with nvm, I have to manually repeat corepack enable. Sometimes our developers forget, which leads to weird version mismatch errors in our other tooling.

Ultimately, I would like a way to opt-in to corepack across all node versions installed by nvm.

Perhaps we can have something akin to https://github.com/nvm-sh/nvm#default-global-packages-from-file-while-installing but specifically for corepack since it's a first-party node feature? This can eventually be removed once corepack is made opt-out in a future version of NodeJS.


nodejs/corepack#192

@ljharb
Copy link
Member

ljharb commented Sep 29, 2022

It’s unclear if that default will ever change in node, and I’m very hesitant to make it easy for users to accidentally have corepack (which breaks a number of valid use cases when enabled) enabled.

I’m not sure what solution would work here regardless - we can’t just detect if there’s a corepack binary, because it’s not present in older nodes (and thus could be something else), and I’d prefer not to add another file. I suppose we could use an env var, but that doesn’t seem like it’d work for your use case, because it wouldn’t be easy to set that up on all your devs’ machines.

Overall, I think that until node has a way to default corepack to be enabled, nobody else should.

@ljharb ljharb added the feature requests I want a new feature in nvm! label Sep 29, 2022
@noahnu
Copy link
Author

noahnu commented Oct 2, 2022

I can add an environment variable in the login shell profile through our provisioning scripts, though I see the concern with supporting an option to enable corepack across versions when corepack itself doesn't support this. Having this come from corepack or node would also ensure this works with other version managers as well.

I might explore an option to auto enable corepack in our provisioning scripts on shell login then, as long as it doesn't cause a noticeable slow down.

Thanks for the quick response.

@ljharb ljharb closed this as not planned Won't fix, can't repro, duplicate, stale Oct 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature requests I want a new feature in nvm!
Projects
None yet
Development

No branches or pull requests

2 participants