You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Agreed. pnpm v7 was released just yesterday and I'd hoped to use corepack moving forward instead of manually installing it for all of our workflows. This is probably done so along the lines of "pin your dependencies," but doesn't meet all needs.
Would this need to perform a network request every time you do pnpm run <script> to check for the latest pnpm, since you can't rely the cached copy anymore?
Would this need to perform a network request every time you do pnpm run <script> to check for the latest pnpm, since you can't rely the cached copy anymore?
This seems kind of odd to restrict matching on exact version when one can provide any dist-tag instead (which can be moved around at will).
Reverting the restriction would help my use case: use corepack to test or try something on a package manager where only the major version matters. I have sinking feeling my use case is out of scope...
Reacted by James Sumners, Dan Rose, Joost Schuur and legobeat
@boneskull The restriction only applies to the package.json ad hoc field, you can still do e.g. corepack pnpm@7.x install, does that cover your use case?
@boneskull are you using an old version of Corepack maybe? For me, running COREPACK_ENABLE_PROJECT_SPEC=0 corepack npm@7 --version works and returns 7.20.1.
The exact version of the package manager prevents me from working on different projects. I don't think most projects need an exact package manager. corepack should introduce the semver strategy likes dependencies management do.
Reacted by Momo Kornher, Matheus, 沈鸿飞, Ben McCann, Melaku Zewdu, Matt W, Abhijeet Singh, Benjamín Vicente, Chris Hiestand and Danilo Hoffmann
I always want to use the latest version of my package manager. The exception usually is on a new major release, when I first have to run a few validations.
With the current restrictions to only exact versions, I have to make a change every time I want to update the version of the package manger. Worst case, this needs to be done through a PR and I need to bother a co-worker with a review.
Reacted by Bo Lingen, Mehul Kar, Ben McCann and Tiago Velho
You can already use corepack up whenever you want to upgrade the package manager, I don't think an implicit upgrade should be encouraged as a good practice.
Reacted by firefoxic, Entranced, Ben McCann, Krishan Taylor, Mirone, Jordane Belanger, Bosco Domingo, Ben Allfree, Mateusz Kadlubowski, David Sanchez and 10 more
What i would like the default behavior to be given version of Node.js 22, is that corepack is enabled by default and pnpm i always installs the same major. I might have misunderstood this issue, but it would look like this is needed for that.
Reacted by Philipp Rudloff, Aelita, Ben McCann, Nicolas Beaussart and Benjamín Vicente
It prevents using hashes to ensure the version is the expected one
It gives users a false sense of confidence that their project will always be installable (bugfixes may be breaking changes)
You can already use corepack up whenever you want to upgrade the package manager, I don't think an implicit upgrade should be encouraged as a good practice.
These are vary valid concerns and I understand that we should encourage explicit versions as the best practice. However I believe that many projects do not currently see this as a major concern, otherwise we would see a lot of very specific engines declaration.
The other use case is really around validation. If corepack already has a version of pnpm installed that satisfies the constraint pnpm@6, why should it install a slightly different version? This is just a waste of resources. Like you've said, users can run corepack up to upgrade. Of course explicit versions are still supported if you as owner prefer this. Ultimately this is about choice.
Reacted by Daniel Bayley, Bo Lingen, Steven, Reda, Christopher Hiller, Matheus, Philip Graham, Philipp Rudloff, Spenser Black, firefoxic and 7 more
Every well known package manager supported by the experimental packageManager field uses semver (and most large opensource projects in general). From that perspective where semver is usually expected, it's common sense that it should be possible to restrict to a major version. If the maintainers of a package manager introduce a breaking change for an existing major version by accident and it breaks our installations, so be it, if someone is that worried about that there should simply be a way of specifying an exact version.
Reacted by firefoxic, Glenn Dwiyatcita, giovanimfmurari, Daniel Leroux, Momo Kornher, Daniel Bayley, Bart Riepe, Bo Lingen, Ben McCann, Joost Schuur and 8 more
if someone is that worried about that there should simply be a way of specifying an exact version
Yeah, this is common practice literally everywhere. If you care about getting exact versions, you specify the exact version. If you do not, you specify a range.
I don't really understand how you can make a field that looks like it's a semver specifier, in a file full of semver specifiers, and then not actually make it semver. Like, wut?
Reacted by 沈鸿飞, firefoxic, Momo Kornher, Bo Lingen, Daniel Bayley, Madison Bullard, Ben McCann, done, Krishan Taylor, Melaku Zewdu and 22 more
Reacted by 沈鸿飞, Daniel Bayley, Nemanja Krunic, Vyachean, Theo Gravity, Bernard and codeflorist
What is the current best practice for this? Remove the entry in the package.json?
You can run corepack up to bump the version in the same major, and corepack use <your package manager>@<major version>.x to use a different major version.
At least, running corepack pnpm@10.0.0 foo bar should ignore packageManager field, while currently it will throw an error if packageManager is specified in semver ranges.
Activity
shellscape commentedon May 2, 2022
Agreed. pnpm v7 was released just yesterday and I'd hoped to use corepack moving forward instead of manually installing it for all of our workflows. This is probably done so along the lines of "pin your dependencies," but doesn't meet all needs.
styfle commentedon Jun 10, 2022
Would this need to perform a network request every time you do
pnpm run <script>to check for the latest pnpm, since you can't rely the cached copy anymore?jsumners commentedon Jun 10, 2022
Good question. I think some sort of "check every X time window" would be acceptable. Similar to https://github.com/ohmyzsh/ohmyzsh/blob/d41ca84af1271e8bfbe26f581cebe3b86521d0db/oh-my-zsh.sh#L59-L62
aduh95 commentedon Jun 29, 2022
It looks like this was originally possible, and was removed in #18.
boneskull commentedon Aug 6, 2023
This seems kind of odd to restrict matching on exact version when one can provide any dist-tag instead (which can be moved around at will).
Reverting the restriction would help my use case: use corepack to test or try something on a package manager where only the major version matters. I have sinking feeling my use case is out of scope...
aduh95 commentedon Aug 6, 2023
@boneskull The restriction only applies to the
package.jsonad hoc field, you can still do e.g.corepack pnpm@7.x install, does that cover your use case?boneskull commentedon Aug 6, 2023
that wasn't working as of a couple hours ago.
corepack npm@7unknown version or smth to that effectboneskull commentedon Aug 9, 2023
wrapping
corepackto support this, I've pulled down the result ofnpm show --json <npm|yarn|pnpm> versions, then use semver to try match a range.aduh95 commentedon Aug 9, 2023
@boneskull are you using an old version of Corepack maybe? For me, running
COREPACK_ENABLE_PROJECT_SPEC=0 corepack npm@7 --versionworks and returns7.20.1.boneskull commentedon Aug 9, 2023
@aduh95 I wonder if the env var was the problem. Seems to work now, thanks.
uiolee commentedon Oct 25, 2023
Totally agree.
The exact version of the package manager prevents me from working on different projects. I don't think most projects need an exact package manager. corepack should introduce the semver strategy likes dependencies management do.
mrgrain commentedon Nov 1, 2023
I always want to use the latest version of my package manager. The exception usually is on a new major release, when I first have to run a few validations.
With the current restrictions to only exact versions, I have to make a change every time I want to update the version of the package manger. Worst case, this needs to be done through a PR and I need to bother a co-worker with a review.
boneskull commentedon Nov 13, 2023
@mrgrain Couldn't you use a dist tag? e.g.,
npm@latestmrgrain commentedon Nov 13, 2023
I don't think dist tags are supported either? If they are, that would certainly be better than nothing.
However the problem with dist tags is
a) it's usually
latestwhich will cause users to receive untested major version upgrades.b) since a dist tag points to a specific version, we still impose an upgrade to the user.
MattSilvaa commentedon Dec 19, 2023
Hi! I'm curious whether a decision has been reached to add the functionality back for supporting semver ranges?
1 remaining item
arcanis commentedon Jan 12, 2024
I'm still not convinced this is a good idea:
You can already use
corepack upwhenever you want to upgrade the package manager, I don't think an implicit upgrade should be encouraged as a good practice.mcollina commentedon Jan 12, 2024
What i would like the default behavior to be given version of Node.js 22, is that corepack is enabled by default and
pnpm ialways installs the same major. I might have misunderstood this issue, but it would look like this is needed for that.mrgrain commentedon Jan 12, 2024
These are vary valid concerns and I understand that we should encourage explicit versions as the best practice. However I believe that many projects do not currently see this as a major concern, otherwise we would see a lot of very specific engines declaration.
The other use case is really around validation. If corepack already has a version of pnpm installed that satisfies the constraint
pnpm@6, why should it install a slightly different version? This is just a waste of resources. Like you've said, users can runcorepack upto upgrade. Of course explicit versions are still supported if you as owner prefer this. Ultimately this is about choice.fix: explicitly set our preferred package manager for js dependencies (…
xsjcTony commentedon Apr 25, 2024
+1
migrate to mise, update dependencies
jordanebelanger commentedon May 7, 2024
Every well known package manager supported by the experimental packageManager field uses semver (and most large opensource projects in general). From that perspective where semver is usually expected, it's common sense that it should be possible to restrict to a major version. If the maintainers of a package manager introduce a breaking change for an existing major version by accident and it breaks our installations, so be it, if someone is that worried about that there should simply be a way of specifying an exact version.
Aeolun commentedon May 14, 2024
Yeah, this is common practice literally everywhere. If you care about getting exact versions, you specify the exact version. If you do not, you specify a range.
I don't really understand how you can make a field that looks like it's a semver specifier, in a file full of semver specifiers, and then not actually make it semver. Like, wut?
fix: remove package.json packageManager field (#1529)
guilherssousa commentedon Aug 14, 2024
+1
anthonyalayo commentedon Jan 23, 2025
What is the current best practice for this? Remove the entry in the package.json?
aduh95 commentedon Jan 24, 2025
You can run
corepack upto bump the version in the same major, andcorepack use <your package manager>@<major version>.xto use a different major version.zanminkian commentedon Aug 26, 2025
At least, running
corepack pnpm@10.0.0 foo barshould ignorepackageManagerfield, while currently it will throw an error ifpackageManageris specified in semver ranges.jordanebelanger commentedon Jan 21, 2026
Not having semver makes this field so damn annoying when working as a team.
karlhorky commentedon Aug 12, 2026
As of 12 Aug 2026 (
pnpm@11.21.0), a freshpnpm initproject breaks immediately with Corepack because of this lack of support of version ranges:Reported over here:
@arcanis or other maintainers: what are your thoughts here? Would Corepack support version ranges, at least for pnpm?
Or is it no longer recommended to use Corepack with pnpm?
pnpm has now unfortunately dropped all mentions of Corepack from the docs because of this 🙁
Workaround: Remove
devEnginesblock frompnpm initFor people stuck with Corepack and pnpm (eg. before you have migrated off Corepack), there's a workaround:
Compare that with the full
pnpm init:$ pnpm init Wrote to /Users/k/p/b/package.json { "name": "b", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], "author": "", "license": "ISC", "devEngines": { "packageManager": { "name": "pnpm", "version": "^11.21.0", "onFail": "download" } }, "type": "module" }