R
Railway10mo ago
elis

Build failing due to missing `.root/.cache/node/corepack/lastKnownGood.json`

My build is failing due to the missing file when installing yarn(?):
#11 0.375 Internal Error: ENOENT: no such file or directory, open '/root/.cache/node/corepack/lastKnownGood.json'

#11 0.375 Error: ENOENT: no such file or directory, open '/root/.cache/node/corepack/lastKnownGood.json'
#11 0.375 Internal Error: ENOENT: no such file or directory, open '/root/.cache/node/corepack/lastKnownGood.json'

#11 0.375 Error: ENOENT: no such file or directory, open '/root/.cache/node/corepack/lastKnownGood.json'
Solution:
Appears Nixpacks uses corepack internally and always uses the latest version Workaround; create a nixpacks.toml file with this inside: ```toml [phases.install]...
Jump to solution
58 Replies
Percy
Percy10mo ago
Project ID: 33042bbf-0475-49c1-9110-2626993a4979
elis
elisOP10mo ago
33042bbf-0475-49c1-9110-2626993a4979 tried refreshing the yarn.lock file (deleting it, deleting node_modules, and installing the project fresh, and push the new yarn.lock file) - didn't resolve
holy shnikes
holy shnikes10mo ago
+1, same error for me right now
elis
elisOP10mo ago
hello? 🥺
Pepijn
Pepijn10mo ago
+1
yrnsmth
yrnsmth10mo ago
+1 here, too!
Pepijn
Pepijn10mo ago
Having this issue on all deployments
yrnsmth
yrnsmth10mo ago
I deployed a rails instance just fine (it uses yarn), but react + vite is failing for me.
Fragly
Fragly10mo ago
I can't manage to reproduce this error, mind sharing some more information about how you guys are deploying your apps? Are all of you using yarn and are all of these NodeJS projects?
Pepijn
Pepijn10mo ago
I have this issue on NextJs and NodeJs projects
Fragly
Fragly10mo ago
and are you using yarn?
Pepijn
Pepijn10mo ago
Yes
Fragly
Fragly10mo ago
Will try and reproduce this with yarn real quick
Pepijn
Pepijn10mo ago
Maybe this is relevant as well: #11 2.224 npm WARN EBADENGINE Unsupported engine { #11 2.225 npm WARN EBADENGINE package: '[email protected]', #11 2.225 npm WARN EBADENGINE required: { node: '^18.17.1 | >=20.10.0' }, #11 2.225 npm WARN EBADENGINE current: { node: 'v21.1.0', npm: '10.2.0' } #11 2.225 npm WARN EBADENGINE }
yrnsmth
yrnsmth10mo ago
I'm using the vite-react-template from Brody ( https://github.com/brody192/vite-react-template), deployed from a GitLab instance. It's using yarn v6. it was working 2 days ago. My only changes were jsx files.
Pepijn
Pepijn10mo ago
I only updated an env Maybe something in the image changed
Fragly
Fragly10mo ago
Very strange, I can't manage to reproduce this, even when using the same template yrnsmth is using
yrnsmth
yrnsmth10mo ago
What is also strange is my rails service is deploying fine, also using yarn v6. On the react project I did a git revert to my changes, and redeployed, this was rejected also.
Pepijn
Pepijn10mo ago
Yeah it seems a cache file is missing in between the deployments then, maybe some of our cached data is gone and now it breaks? Is there a way to rebuild without any cache?
Fragly
Fragly10mo ago
setting NIXPACKS_NO_CACHE to 1 is one way another thing that could be worth trying is: https://bookmarklets.up.railway.app/service-redeploy/
elis
elisOP10mo ago
How do I do that? Can I add to it ENV vars or do I need the railway.json? in railway.json at the top level?
Fragly
Fragly10mo ago
you can do it in your service variables
Pepijn
Pepijn10mo ago
The ENV did not help for me
Fragly
Fragly10mo ago
Could you try the bookmarklet?
elis
elisOP10mo ago
just regular push/deploy - i have a turborepo monorepo setup, and building a vike (vite plugin ssr) app - yesterday it worked fine
Pepijn
Pepijn10mo ago
The bookmarklet does not work either, it skipped due to no file changes because of the watch paths. I will try whitout watch paths No luck I also have turborepo btw
elis
elisOP10mo ago
env var didn't do it for me - added it here, somehow feeling it's not the place:
No description
Fragly
Fragly10mo ago
that is the correct place, no worries
elis
elisOP10mo ago
gotcha - so I set it to 1 still failing on yarn install --frozen-lockfile:
> [ 7/11] RUN yarn install --frozen-lockfile:

0.379 Internal Error: ENOENT: no such file or directory, open '/root/.cache/node/corepack/lastKnownGood.json'

0.379 Error: ENOENT: no such file or directory, open '/root/.cache/node/corepack/lastKnownGood.json'

-----
> [ 7/11] RUN yarn install --frozen-lockfile:

0.379 Internal Error: ENOENT: no such file or directory, open '/root/.cache/node/corepack/lastKnownGood.json'

0.379 Error: ENOENT: no such file or directory, open '/root/.cache/node/corepack/lastKnownGood.json'

-----
yrnsmth
yrnsmth10mo ago
😬
No description
Fragly
Fragly10mo ago
And just to make sure, it was all working about a day ago, right?
elis
elisOP10mo ago
aye
yrnsmth
yrnsmth10mo ago
Yep - and the previous working deploy is still up and running fine
Fragly
Fragly10mo ago
super strange
elis
elisOP10mo ago
pushing without yarn.lock to see what'll happen 😄 same here - existing service runs a warning i'm seeing - not sure if its related:
#10 1.555 npm WARN EBADENGINE Unsupported engine {

#10 1.555 npm

WARN EBADENGINE package: '[email protected]',

#10 1.556 npm WARN EBADENGINE required: { node: '^18.17.1 | >=20.10.0' },

#10 1.556 npm WARN EBADENGINE current: { node: 'v20.9.0', npm: '10.1.0' }

#10 1.556 npm WARN EBADENGINE }

#10 1.706

#10 1.706 changed 1 package in 1s
#10 1.555 npm WARN EBADENGINE Unsupported engine {

#10 1.555 npm

WARN EBADENGINE package: '[email protected]',

#10 1.556 npm WARN EBADENGINE required: { node: '^18.17.1 | >=20.10.0' },

#10 1.556 npm WARN EBADENGINE current: { node: 'v20.9.0', npm: '10.1.0' }

#10 1.556 npm WARN EBADENGINE }

#10 1.706

#10 1.706 changed 1 package in 1s
Fragly
Fragly10mo ago
oh wait, that would definitally be related it requires 20.10.0 but you're on 20.9.0
elis
elisOP10mo ago
didn't work any way I can configure that?
Pepijn
Pepijn10mo ago
For me that is also a warning I see, but when I check the earlier succesfull build it was using the same node js version
elis
elisOP10mo ago
in the package.json my engines is set to
"engines": {
"node": "^20.0.0"
},
"engines": {
"node": "^20.0.0"
},
Pepijn
Pepijn10mo ago
You can set node version with NIXPACKS_NODE_VERSION
Fragly
Fragly10mo ago
it should also pick it up from the node engine version set in your package.json
nikolalsvk
nikolalsvk10mo ago
Not sure if anyone shared here but corepack has a bug https://github.com/nodejs/corepack/issues/379
GitHub
v0.25.0 crashes with ENOENT on fresh install · Issue #379 · nodejs/...
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: EN...
elis
elisOP10mo ago
bam!
nikolalsvk
nikolalsvk10mo ago
The 0.25.0 was released ~2 hours ago, I'm checking whether there's a way to use 0.24.1 version instead I made the fix in my CI pipeline by using npm install -g [email protected] but not sure how to do it in Railway because it is using nixpacks 🤔
Pepijn
Pepijn10mo ago
Ah
Fragly
Fragly10mo ago
That makes so much sense
ducthu
ducthu10mo ago
yeah due to that update, can't release right now 😂
Fragly
Fragly10mo ago
yea you just install that version
ducthu
ducthu10mo ago
I already tried to force an version on that package, but no affects. it is handled by railway before installing the project
elis
elisOP10mo ago
is it something that can be configured via railway.json?
Solution
Fragly
Fragly10mo ago
Appears Nixpacks uses corepack internally and always uses the latest version Workaround; create a nixpacks.toml file with this inside:
[phases.install]
cmds = ["npm install -g [email protected] && corepack enable", "yarn install --check-cache"]
dependsOn = ["setup"]
[phases.install]
cmds = ["npm install -g [email protected] && corepack enable", "yarn install --check-cache"]
dependsOn = ["setup"]
elis
elisOP10mo ago
yay! it's passed to the next stage! project installing 😄
elis
elisOP10mo ago
worked! Thanks!!!
yrnsmth
yrnsmth10mo ago
Thanks all!
ducthu
ducthu10mo ago
🙏
Carson
Carson10mo ago
Running into this issue, thank you all for debugging this already. Appreciate the open communication
Brody
Brody10mo ago
deploys via railway up do not create a source, if that's how the deployment was done, you can redeploy via the deployments 3 dot menu or by doing railway up again
Want results from more Discord servers?
Add your server