R
Railway9mo 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
Percy9mo ago
Project ID: 33042bbf-0475-49c1-9110-2626993a4979
elis
elis9mo 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 shnikes9mo ago
+1, same error for me right now
elis
elis9mo ago
hello? 🥺
Pepijn
Pepijn9mo ago
+1
yrnsmth
yrnsmth9mo ago
+1 here, too!
Pepijn
Pepijn9mo ago
Having this issue on all deployments
yrnsmth
yrnsmth9mo ago
I deployed a rails instance just fine (it uses yarn), but react + vite is failing for me.
Fragly
Fragly9mo 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
Pepijn9mo ago
I have this issue on NextJs and NodeJs projects
Fragly
Fragly9mo ago
and are you using yarn?
Pepijn
Pepijn9mo ago
Yes
Fragly
Fragly9mo ago
Will try and reproduce this with yarn real quick
Pepijn
Pepijn9mo 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
yrnsmth9mo 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
Pepijn9mo ago
I only updated an env Maybe something in the image changed
Fragly
Fragly9mo ago
Very strange, I can't manage to reproduce this, even when using the same template yrnsmth is using
yrnsmth
yrnsmth9mo 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
Pepijn9mo 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
Fragly9mo 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
elis9mo 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
Fragly9mo ago
you can do it in your service variables
Pepijn
Pepijn9mo ago
The ENV did not help for me
Fragly
Fragly9mo ago
Could you try the bookmarklet?
elis
elis9mo ago
just regular push/deploy - i have a turborepo monorepo setup, and building a vike (vite plugin ssr) app - yesterday it worked fine
Pepijn
Pepijn9mo 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
elis9mo ago
env var didn't do it for me - added it here, somehow feeling it's not the place:
No description
Fragly
Fragly9mo ago
that is the correct place, no worries
elis
elis9mo 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
yrnsmth9mo ago
😬
No description
Fragly
Fragly9mo ago
And just to make sure, it was all working about a day ago, right?
elis
elis9mo ago
aye
yrnsmth
yrnsmth9mo ago
Yep - and the previous working deploy is still up and running fine
Fragly
Fragly9mo ago
super strange
elis
elis9mo 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
Fragly9mo ago
oh wait, that would definitally be related it requires 20.10.0 but you're on 20.9.0
elis
elis9mo ago
didn't work any way I can configure that?
Pepijn
Pepijn9mo 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
elis9mo ago
in the package.json my engines is set to
"engines": {
"node": "^20.0.0"
},
"engines": {
"node": "^20.0.0"
},
Pepijn
Pepijn9mo ago
You can set node version with NIXPACKS_NODE_VERSION
Fragly
Fragly9mo ago
it should also pick it up from the node engine version set in your package.json
nikolalsvk
nikolalsvk9mo 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
elis9mo ago
bam!
nikolalsvk
nikolalsvk9mo 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
Pepijn9mo ago
Ah
Fragly
Fragly9mo ago
That makes so much sense
ducthu
ducthu9mo ago
yeah due to that update, can't release right now 😂
Fragly
Fragly9mo ago
yea you just install that version
ducthu
ducthu9mo ago
I already tried to force an version on that package, but no affects. it is handled by railway before installing the project
elis
elis9mo ago
is it something that can be configured via railway.json?
Solution
Fragly
Fragly9mo 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
elis9mo ago
yay! it's passed to the next stage! project installing 😄
elis
elis9mo ago
worked! Thanks!!!
yrnsmth
yrnsmth9mo ago
Thanks all!
ducthu
ducthu9mo ago
🙏
Carson
Carson9mo ago
Running into this issue, thank you all for debugging this already. Appreciate the open communication
Brody
Brody9mo 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