corepack icon indicating copy to clipboard operation
corepack copied to clipboard

v0.25.0 crashes with ENOENT on fresh install

Open merceyz opened this issue 1 year ago • 5 comments

In a fresh docker container running Corepack crashes with ENOENT

$ docker run --rm -it node:20.11.1 bash -c "npm install -g [email protected] && corepack yarn -v"
Internal Error: ENOENT: no such file or directory, open '/root/.cache/node/corepack/lastKnownGood.json'
Error: ENOENT: no such file or directory, open '/root/.cache/node/corepack/lastKnownGood.json'

Git bisect points to https://github.com/nodejs/corepack/pull/364.

merceyz avatar Feb 20 '24 09:02 merceyz

Same issue here. Maybe related to this change in v0.25.0 ?

devj3ns avatar Feb 20 '24 09:02 devj3ns

Yeah, git bisect points to https://github.com/nodejs/corepack/pull/364.

merceyz avatar Feb 20 '24 09:02 merceyz

Same issue here on railway.app -- we're seeing a lot of user builds utilizing corepack fail due to this.

Our current workaround is to install the last known good release (0.24.1):

npm install -g [email protected]

half0wl avatar Feb 20 '24 11:02 half0wl

I'm using railway.app with nixpacks and the fix is to create a nixpacks.toml with this:

[phases.install]
cmds = ["npm install -g [email protected] && corepack enable", "pnpm i --frozen-lockfile"]
dependsOn = ["setup"]

I'm using pnpm i --frozen-lockfile but you can replace it with the command of your choice.

nikolalsvk avatar Feb 20 '24 11:02 nikolalsvk

I have a potential fix: https://github.com/nodejs/corepack/pull/382 If someone could try it out and confirm if it solves the issue, that'd be great.

aduh95 avatar Feb 20 '24 12:02 aduh95

we ran into this as well. running corepack install --global <yarn-version> fixes the issue, but we have to run that separately for each user that needs to use yarn.

ajw725 avatar Feb 20 '24 19:02 ajw725

Thanks for the quick fix aduh95! I'm wondering since this is breaking many peoples CI - when is the plan to release this? I can't do a workaround for my usage of https://docs.renovatebot.com/ as it is a third party tool that depends on this working.

ntucker avatar Feb 21 '24 15:02 ntucker

v0.25.2 is out with the fix. Let us know if you're still issues.

aduh95 avatar Feb 21 '24 16:02 aduh95

Thanks, working great now!

ntucker avatar Feb 21 '24 17:02 ntucker

Thanks, it works as expected !

Elantest avatar Feb 21 '24 18:02 Elantest

Thanks for the quick fix aduh95! I'm wondering since this is breaking many peoples CI - when is the plan to release this? I can't do a workaround for my usage of https://docs.renovatebot.com/ as it is a third party tool that depends on this working.

You can pin corepack and other tools in such situations https://github.com/renovatebot/renovate/discussions/27465

secustor avatar Feb 21 '24 18:02 secustor

Works on the brew side. Thanks for the quick fix!

  • https://github.com/Homebrew/homebrew-core/pull/163328

chenrui333 avatar Feb 21 '24 18:02 chenrui333