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
{{ message }}
Repository navigation
After corepack disable npm Corepack cannot be updated #692
If Corepack is disabled for npm (for instance after enabling it) and an attempt is made to update Corepack, then the installation of Corepack according to the instructions in the README > Manual Installs > Update Corepack using npm fail since npm is no longer available.
Expected behavior
Corepack should issue a prompt and a warning about the consequences of executing corepack disable npm
The README document should describe how to recover after executing corepack enable npm and then needing to disable npm with respect to Corepack.
Yes, it's related. There is also a description in that issue of the difficulty that Corepack would have if it tried to save and restore the previous status.
For yarn or pnpm after disabling them through corepack, you can install them globally with npm, so the workaround is fairly simple.
I guess it's subjective whether having to reinstall Node.js to reinstall the bundled npm version is regarded as simple.
corepack enable doesn't enable npm by default, you have to explicitly specify corepack enable npm. I would guess that there are low numbers of users of Corepack with npm, although I have no real way of knowing. I expect this is why the issue hasn't been reported previously.
Thanks for the search string! It turns out that npm usage (14.8k) is followed by Yarn v1 Classic (28.2k), then Yarn Modern (68.7k), with pnpm (120k) at the top of the list.
I think we can close this as duplicate then, if npm is not installed or has been uninstalled, you may use corepack npm – or you need to (re)install it – to run npm commands.
Yes, the root cause is a duplicate of #112
Issue #112 does not however mention any suggestion to add the restriction to the README documentation or to add the advice on how to update Corepack to the README after having executed corepack disable npm
Activity
styfle commentedon Mar 31, 2025
Sounds similar to #112
MikeMcC399 commentedon Mar 31, 2025
@styfle
Yes, it's related. There is also a description in that issue of the difficulty that Corepack would have if it tried to save and restore the previous status.
For yarn or pnpm after disabling them through corepack, you can install them globally with npm, so the workaround is fairly simple.
I guess it's subjective whether having to reinstall Node.js to reinstall the bundled npm version is regarded as simple.
corepack enabledoesn't enable npm by default, you have to explicitly specifycorepack enable npm. I would guess that there are low numbers of users of Corepack with npm, although I have no real way of knowing. I expect this is why the issue hasn't been reported previously.styfle commentedon Mar 31, 2025
There are about 15k public repos using it on github:
https://github.com/search?q=%22%5C%22packageManager%5C%22%3A+%5C%22npm%40%22+path%3Apackage.json&type=code
aduh95 commentedon Mar 31, 2025
What does
corepack npm i -g corepack@latestdo?MikeMcC399 commentedon Apr 1, 2025
@aduh95
The following sequence is successful in updating Corepack to
latest(currently0.32.0), tested in the environment:Corepack
0.31.0Ubuntu
22.04.2LTSNode.js
22.14.0LTS installed using the n Node.js version managercorepack enable npm corepack disable npm corepack npm install -g corepack@latestShould this be added to the documentation?
Logs
MikeMcC399 commentedon Apr 1, 2025
@styfle
Thanks for the search string! It turns out that npm usage (14.8k) is followed by Yarn v1 Classic (28.2k), then Yarn Modern (68.7k), with pnpm (120k) at the top of the list.
MikeMcC399 commentedon Apr 1, 2025
This also affects other npm commands that are not project based, for example:
This can be worked around by prefixing each npm command with
corepack:aduh95 commentedon Apr 1, 2025
I think we can close this as duplicate then, if
npmis not installed or has been uninstalled, you may usecorepack npm– or you need to (re)install it – to run npm commands.MikeMcC399 commentedon Apr 1, 2025
Yes, the root cause is a duplicate of #112
Issue #112 does not however mention any suggestion to add the restriction to the README documentation or to add the advice on how to update Corepack to the README after having executed
corepack disable npm