Builds fail due to nixpack using nodejs_20 instead of nodejs_18
My builds fail need some attention please.
Previous successful build: nixpack 1.15 nodejs_18
Failing build: nixpack 1.16 nodejs_20
Error 1.866 error @azure/[email protected]: The engine "node" is incompatible with this module. Expected version "10 12 14 16 18". Got "20.6.1"
14 Replies
are you somewhere specifying you want to use node 20?
No, i don't
is there anyway I can pin the version?
set engines.node to 18 in your package.json
@Rem Kim - Did that suggestion work?
Hopping in here - I had the same issue, and I just updated my engines.node from ">=16.0.0" to ">=16.0.0 <20.0.0", and it fixed my builds! ✅
Looks like Nixpacks v1.16.0 shipped with Node 20 as the default?
nixpacks v1.16.0 added support for node 20, and node 20 is greater than node 16, previously the max supported was 18
the default node version in nixpacks v1.16.0 is now set to 18
Yep if you don't pin it, we use latest even by default since it's LTS
If the default version is now 18 (with 20 now being supported), is it expected behavior that Nixpacks will choose 20 if my engines.node is set to ">=16.0.0"?
@Angelo Beat me to it, thanks!
Engines will use the latest lts
well version 20 is greater than 16, so it did give you what you asked for lol
Got it, thanks for the help!
no problem!
Solution
I fixed it by adding railway.json and pinning nixpack version
Woohoo, again, sorry that you faced this issue - rough patch on the Node 16 LTS EOL
Locking thread.