nodejs / corepack

Zero-runtime-dependency package acting as bridge between Node projects and their package managers
MIT License
2.36k stars 150 forks source link

v0.25.0 crashes with ENOENT on fresh install #379

Closed merceyz closed 5 months ago

merceyz commented 5 months ago

In a fresh docker container running Corepack crashes with ENOENT

$ docker run --rm -it node:20.11.1 bash -c "npm install -g corepack@0.25.0 && 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.

devj3ns commented 5 months ago

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

merceyz commented 5 months ago

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

half0wl commented 5 months ago

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 corepack@0.24.1
nikolalsvk commented 5 months ago

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

[phases.install]
cmds = ["npm install -g corepack@0.24.1 && 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.

aduh95 commented 5 months ago

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.

ajw725 commented 5 months ago

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.

ntucker commented 5 months ago

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.

aduh95 commented 5 months ago

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

ntucker commented 5 months ago

Thanks, working great now!

Elantest commented 5 months ago

Thanks, it works as expected !

secustor commented 5 months ago

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

chenrui333 commented 5 months ago

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