Dependencies Install failing for yarn + prisma/client
Hey there! This is what I am getting in deployment logs (file attached).
config:
╔════════════════════ Nixpacks v1.19.0 ═══════════════════╗
║ setup │ nodejs_21, yarn-1_x, openssl ║
║─────────────────────────────────────────────────────────║
║ install │ npm install -g corepack && corepack enable ║
║ │ yarn install --frozen-lockfile ║
║─────────────────────────────────────────────────────────║
║ build │ yarn build ║
║─────────────────────────────────────────────────────────║
║ start │ yarn start ║
╚═════════════════════════════════════════════════════════╝
package.json:
{
"packageManager": "[email protected]",
"scripts": {
"..."
},
"dependencies": {
"@prisma/client": "4.9.0",
"..."
},
"devDependencies": {
"prisma": "4.9.0",
"...",
},
"prisma": {
"seed": "ts-node ./prisma/seed.ts"
},
"engines": {
"node": ">=18.17.1"
}
}
(this is a monorepo, and I added a specific yarn.lock in the folder of the package.json)
Any ideas? Honestly I don't know what else to try since it is a pretty standard set up 😢
Thanks in advance!!!
48 Replies
Project ID:
N/A
5e850af2-d74a-4973-a849-a0107b7a93d4
build logs please https://bookmarklets.up.railway.app/log-downloader/
in your package.json set
engines.node
to just 18
looks good
node = 18, same error
[stage-0 7/11] RUN --mount=type=cache,id=s/d5b56c84-15ed-47e1-80c8-fac8c9f9fea6-/usr/local/share/cache/yarn/v6,target=/usr/local/share/.cache/yarn/v6 yarn install --frozen-lockfile:63.02 ➤ YN0000: │ @prisma/client@npm:4.9.0 [00c3b] STDERR at new NodeError (node:internal/errors:405:5) 63.02 ➤ YN0000: │ @prisma/client@npm:4.9.0 [00c3b] STDERR at ESMLoader.resolve (node:internal/modules/esm/loader:843:13) 63.02 ➤ YN0000: │ @prisma/client@npm:4.9.0 [00c3b] STDERR at async ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:7) { 63.02 ➤ YN0000: │ @prisma/client@npm:4.9.0 [00c3b] STDERR code: 'ERR_LOADER_CHAIN_INCOMPLETE' 63.02 ➤ YN0000: │ @prisma/client@npm:4.9.0 [00c3b] STDERR } 63.02 ➤ YN0000: │ @prisma/client@npm:4.9.0 [00c3b] STDERR 63.02 ➤ YN0000: │ @prisma/client@npm:4.9.0 [00c3b] STDERR Node.js v18.18.2 63.03 ➤ YN0009: │ @prisma/client@npm:4.9.0 [00c3b] couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-ba6c3355/build.log) 63.03 ➤ YN0000: └ Completed in 4s 365ms 63.05 ➤ YN0000: Failed with errors in 59s 357ms
build logs again please
yarn version may be the problem?
in my local same code works as expected so maybe something related to environment tools vversions? e.g. yarn?
what version of yarn do you use locally?
➜ backend git:(release) yarn -v
3.2.1
use yarn 1 locally, and regen your lock file with yarn 1
i've set
"packageManager": "[email protected]",
i know, but please try what i suggested
one sec
can .yarn with cache files and yarn releases help?
i was looking to see if a yarn lock file made with yarn 1 would work, have you tested this?
on it
having troubles with yarn versions
is yarn 2 supported/
?
lets just test a lock file done with yarn 1 for now please
yeah trying but breaking a lot other stuff
no worries
that's why I ask, maybe yarn 2 is easier to try
i think it would be best to use yarn 1 locally
meanwhile quick question, railway savves already downloaded dependencies in cache somewhere to avoid re-downloading and log times of delpoyment?
yes they do have caching
okay, so, the thing is that I have a monorepo with multiple packages, this is one of them.
using yarn v1, I have a root yarn.lock.and because I dont have a yarn.lock in this package, it is trying to use npm ci
║ install │ npm install -g corepack && corepack enable ║
║ │ npm ci
shared monrorepo or isolated monorepo?
shared i think, why
are you using turbo or nx?
none
whats your root directory set to in the service settings
/packages/backend
for a shared monorepo you want to leave the root directory at /
then have specific build and start scripts to just build and just start the backend
it worked!! thank you very much
no prob 🙂
last one, any ideas on how to optimize and don't use root directory?
that's the standard for shared monorepos, perhaps you are asking how to stop either services from building when you make changes in either service?
oh no, I mean, it would be great if I can isolate and have only this package (optimizes size, loading time etc). My packages does not use anything from others, but the limitation here remember is that I can't have a local yarn.lock (so it will know and run yarn instead of npm ci) using yarn 1
pretty sure the npm check is done before the yarn check, you should be able to have a package lock and a yarn lock and have railway default to npm ci, though I haven't tested this
nope I was wrong, just looked at the package detection logic, npm is the default but if any other lock file is found it will default to that package manager instead
though you can just overwrite the default install command with a nixpacks.toml file
this should run
npm ci
regardless of your detected package manager
since you corrected yourself and said this isn't a shared monorepo, you could go back to setting the root directory and then just overwrite the install command like shown above (the nixpacks.toml file needs to be in the same folder as whatever the root directory is set to)brody, are u there?
I found this example using yarn 3.2.4
GitHub
nixpacks/examples/node-yarn-berry/package.json at 61f497b7a25de3fc9...
App source + Nix packages + Docker = Image. Contribute to railwayapp/nixpacks development by creating an account on GitHub.
So:
- set root to /package/backend
- set .yarnrc.yml: yarnPath: .yarn/releases/yarn-3.2.4.cjs
- set packageManager in each package.json
- set the yarn release file in .yarn/releases
-even added the nixpacks.tml =
[phases.install]
cmds = ["yarn install --omit-dev"]
still does not recognize the version of yarn to run.
I need to use other than yarn 1
╔═════════════ Nixpacks v1.19.0 ════════════╗
║ setup │ nodejs_18, yarn-1_x, openssl ║
║───────────────────────────────────────────║
║ install │ yarn install --omit-dev ║
║───────────────────────────────────────────║
║ build │ yarn build-backend ║
║───────────────────────────────────────────║
║ start │ yarn start-backend ║
╚═══════════════════════════════════════════╝
GitHub
nixpacks/src/providers/node/mod.rs at 61f497b7a25de3fc9da20e695569d...
App source + Nix packages + Docker = Image. Contribute to railwayapp/nixpacks development by creating an account on GitHub.
it would significantly help if you could share your repo
managed to make it work, by reading the code of nixpacks.
basically I provided it all (.yarn/release, .yarnrc.yml and a basic .toml choosing the install command)
Now I am using the latest yarn version and running from the root.
Thank you so much for all your help.
awsome, happy you found a solution!