24 days ago
I'm deploying a backend on Railway (Express + Prisma + PostgreSQL) that generates PDF reports with charts using canvas@2.11.2 and chartjs-node-canvas. Deployment fails because Railway uses Node.js 22, and canvas has no prebuilt binaries for that version. I tried forcing Node.js 20 via .nixpacks.toml, railway.toml, and package.json, but Railway ignores all and sticks to Node 22.
I also tried using a Dockerfile with node:20-alpine, but Railway ignores it and defaults to Nixpacks. I attempted source compilation by adding all required aptPkgs, but it fails due to missing Python and other libs.
Questions:
Has anyone successfully forced Node.js 20 on Railway with Nixpacks?
Is there an alternative to canvas that works with Node.js 22?
Can Railway be configured to use Docker instead of Nixpacks?
Any way to enable chart generation in this setup?
For now, I disabled chart generation and the backend runs fine, but I need to restore full functionality. Any help appreciated!
1 Replies
23 days ago
Yes, you can build your custom own docker image or use a .nvmrc. Another alternative it's upgrading your canvas version to 3.2.x.
22 days ago
I did what you say, and It works, thanks
22 days ago
Sure, how it works?
Status changed to Solved brody • 22 days ago
Status changed to Solved noahd • 22 days ago
22 days ago
sorted ;)
22 days ago
!s

