W
Wasp•5mo ago
wardbox

Specify node version for fly.io deployment via wasp deploy fly deploy

Seeing this error when my server launches on fly.io
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] /app/node_modules/sharp/lib/sharp.js:113
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] throw new Error(help.join('\n'));
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] ^
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] Error: Could not load the "sharp" module using the linuxmusl-x64 runtime
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] Possible solutions:
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] - Please upgrade Node.js:
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] Found 20.0.0
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] Requires ^18.17.0 || ^20.3.0 || >=21.0.0
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] - Consult the installation documentation:
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] See https://sharp.pixelplumbing.com/install
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] at Object.<anonymous> (/app/node_modules/sharp/lib/sharp.js:113:9)
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] at Module._compile (node:internal/modules/cjs/loader:1267:14)
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] at Module._extensions..js (node:internal/modules/cjs/loader:1321:10)
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] at Module.load (node:internal/modules/cjs/loader:1125:32)
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] at Module._load (node:internal/modules/cjs/loader:965:12)
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] at Module.require (node:internal/modules/cjs/loader:1149:19)
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] at require (node:internal/modules/helpers:121:18)
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] at Object.<anonymous> (/app/node_modules/sharp/lib/constructor.js:10:1)
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] at Module._compile (node:internal/modules/cjs/loader:1267:14)
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] at Module._extensions..js (node:internal/modules/cjs/loader:1321:10)
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] Node.js v20.0.0
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] /app/node_modules/sharp/lib/sharp.js:113
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] throw new Error(help.join('\n'));
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] ^
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] Error: Could not load the "sharp" module using the linuxmusl-x64 runtime
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] Possible solutions:
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] - Please upgrade Node.js:
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] Found 20.0.0
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] Requires ^18.17.0 || ^20.3.0 || >=21.0.0
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] - Consult the installation documentation:
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] See https://sharp.pixelplumbing.com/install
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] at Object.<anonymous> (/app/node_modules/sharp/lib/sharp.js:113:9)
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] at Module._compile (node:internal/modules/cjs/loader:1267:14)
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] at Module._extensions..js (node:internal/modules/cjs/loader:1321:10)
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] at Module.load (node:internal/modules/cjs/loader:1125:32)
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] at Module._load (node:internal/modules/cjs/loader:965:12)
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] at Module.require (node:internal/modules/cjs/loader:1149:19)
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] at require (node:internal/modules/helpers:121:18)
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] at Object.<anonymous> (/app/node_modules/sharp/lib/constructor.js:10:1)
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] at Module._compile (node:internal/modules/cjs/loader:1267:14)
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] at Module._extensions..js (node:internal/modules/cjs/loader:1321:10)
2025-05-09T01:22:20.563 app[48ed090ce42e78] sea [info] Node.js v20.0.0
Is there a way to specify the version of node the Dockerfile uses via wasp deploy fly deploy? Wasp version 0.16.3
29 Replies
kapa.ai
kapa.ai•5mo ago
Hi @wardbox. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the error message you're seeing, it appears that the Sharp module requires Node.js version ^18.17.0 ^20.3.0 >=21.0.0, but your Fly.io deployment is using Node.js v20.0.0, which doesn't meet these requirements. From the knowledge sources provided, I can see that Wasp has been updating its Node.js version requirements over time. In the past, Wasp had strict Node.js version requirements (only supporting specific LTS versions), but in more recent versions (since around version 0.12), Wasp has relaxed these requirements to support Node.js 18 and above. However, I don't see specific information in the knowledge sources about how to customize the Node.js version used in the Dockerfile generated by wasp deploy fly deploy. The error you're encountering is specifically related to the Sharp module, which requires a newer version of Node.js than what's currently being used in your deployment. You might want to: 1. Check if there's a way to modify the Dockerfile that Wasp generates before deployment 2. Contact the Wasp team through their Discord or GitHub for specific guidance on customizing the Node.js version for Fly.io deployments 3. Consider using a compatible version of Node.js locally when developing your application Unfortunately, the knowledge sources don't contain enough information to provide a definitive solution for specifying the Node.js version in the Dockerfile used by wasp deploy fly deploy. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @wardbox, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
wardbox
wardboxOP•5mo ago
downgrading to 32.6 fixed it. trying a better fix now 😄 better fix didn't work :FeelsBadMan: i tried installing the relevant version for linux musl npm install --cpu=x64 --os=linux --libc=musl sharp no dice, still needed a higher version of node
Vinny (@Wasp)
Vinny (@Wasp)•3mo ago
did you ever get this to work?
wardbox
wardboxOP•3mo ago
no 😦 just have sharp pinned at 32.6
Vinny (@Wasp)
Vinny (@Wasp)•3mo ago
got dammit. I'm struggling with this too.
wardbox
wardboxOP•3mo ago
i think it's just because wasp needs a specific version of node, so gotta wait until it's bumped to ^20.3.0
Vinny (@Wasp)
Vinny (@Wasp)•3mo ago
two things I'm about to try: 1. change the node version in your .wasp/build/Dockerfile and run wasp deploy fly deploy --build-locally if that doesn't work I'll try 2. create a Dockerfile in the root of your wasp project with the node version you need and it will append it to the end of your created dockerfile when you run wasp deploy, e.g.
# This overrides the 'base' stage to use the correct Node.js version,
# which subsequent build stages in the generated file will inherit.
FROM node:22.13.1-alpine as node
# This overrides the 'base' stage to use the correct Node.js version,
# which subsequent build stages in the generated file will inherit.
FROM node:22.13.1-alpine as node
wardbox
wardboxOP•3mo ago
would that work with wasp deploy fly deploy? didn't know about that flag, that's neat
Vinny (@Wasp)
Vinny (@Wasp)•3mo ago
I dont know much about Docker but I'd try creating the additional Dockerfile in root and just trying to deploy again. my local build is running now so I'll see if that works first taking forever though
Vinny (@Wasp)
Vinny (@Wasp)•3mo ago
yay the custom root Dockerfile override is working
No description
wardbox
wardboxOP•3mo ago
i had no idea that existed, pretty cool
Vinny (@Wasp)
Vinny (@Wasp)•3mo ago
hm. the server keeps crashing on fly after doing this. maybe you're right that it's not possible to push the node version on the dockerfile to >= 22 for wasp. Any idea here @Carlos ? i added the custom dockerfile config:
FROM node:22.13.1-alpine as node
FROM node:22.13.1-alpine as node
because a library depends on this version
Carlos
Carlos•3mo ago
How is it crashing?
Vinny (@Wasp)
Vinny (@Wasp)•3mo ago
it just never seems to get started maybe i'm using a bad node version. I think fly just sucks. I reverted back to the default node version and it still doen't deploy. gonna try railway. @Carlos do we have to use alpine3.17 or is the latest version of alpine suitable?
Carlos
Carlos•3mo ago
oof i don't follow alpine news so i don't really know, but i don't think there's any specific reason it shouldn't work on the last version try it
Vinny (@Wasp)
Vinny (@Wasp)•3mo ago
yeah so prisma is the issue with 22.13.1-alpine
> prisma migrate deploy --schema=../db/schema.prisma

prisma:warn Prisma failed to detect the libssl/openssl version to use, and may not work as expected. Defaulting to "openssl-1.1.x".
Please manually install OpenSSL and try installing Prisma again.
prisma:warn Prisma failed to detect the libssl/openssl version to use, and may not work as expected. Defaulting to "openssl-1.1.x".
Please manually install OpenSSL and try installing Prisma again.
Prisma schema loaded from ../db/schema.prisma
Datasource "db": PostgreSQL database "railway", schema "public" at "postgres.railway.internal:5432"
> prisma migrate deploy --schema=../db/schema.prisma

prisma:warn Prisma failed to detect the libssl/openssl version to use, and may not work as expected. Defaulting to "openssl-1.1.x".
Please manually install OpenSSL and try installing Prisma again.
prisma:warn Prisma failed to detect the libssl/openssl version to use, and may not work as expected. Defaulting to "openssl-1.1.x".
Please manually install OpenSSL and try installing Prisma again.
Prisma schema loaded from ../db/schema.prisma
Datasource "db": PostgreSQL database "railway", schema "public" at "postgres.railway.internal:5432"
Vinny (@Wasp)
Vinny (@Wasp)•3mo ago
are we updating Prisma soon?
Vinny (@Wasp)
Vinny (@Wasp)•3mo ago
Vinny (@Wasp)
Vinny (@Wasp)•3mo ago
looks like it 🙂
Carlos
Carlos•3mo ago
I guess before 1.0
Zuck
Zuck•3mo ago
hey ya'll @Vinny (@Wasp) @Carlos im running into this as well whats the solution on this?
Vinny (@Wasp)
Vinny (@Wasp)•3mo ago
if there's a library that requires a higher node version you're going to just have to wait until next week when we release the new Wasp update. I believe we will update to Prisma v6 with that, is that correct @Filip ? Becuase there is a prisma bug in versions <6 keeping us from being able to use node v >20
Zuck
Zuck•3mo ago
ya its all related @Carlos i ended up finding 1 specific node version that works with vite 7 requirements, doesnt have prisma error or agron2 error FROM node:20.19.0-bullseye-slim AS base i rebuilt from source RUN npm rebuild @node-rs/argon2 --build-from-source And made sure i built openssl libssl-dev
Carlos
Carlos•3mo ago
oki, we're investigating, probably launching a hotfix in the short future
Filip
Filip•3mo ago
@Zuck Like I mentioned in the other thread, this has been hotfixed in 0.16.7!
Zuck
Zuck•3mo ago
oh awesome ! @Filip

Did you find this page helpful?