R
Railway11mo ago
Rem Kim

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/msal-node@1.14.4: The engine "node" is incompatible with this module. Expected version "10 12 14 16 18". Got "20.6.1"
Solution:
I fixed it by adding railway.json and pinning nixpack version
Jump to solution
14 Replies
Brody
Brody11mo ago
are you somewhere specifying you want to use node 20?
Rem Kim
Rem Kim11mo ago
No, i don't is there anyway I can pin the version?
Brody
Brody11mo ago
set engines.node to 18 in your package.json
angelo
angelo11mo ago
@Rem Kim - Did that suggestion work?
Rami Abdou
Rami Abdou11mo ago
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?
Brody
Brody11mo ago
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
angelo
angelo11mo ago
Yep if you don't pin it, we use latest even by default since it's LTS
Rami Abdou
Rami Abdou11mo ago
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!
angelo
angelo11mo ago
Engines will use the latest lts
Brody
Brody11mo ago
well version 20 is greater than 16, so it did give you what you asked for lol
Rami Abdou
Rami Abdou11mo ago
Got it, thanks for the help!
Brody
Brody11mo ago
no problem!
Solution
Rem Kim
Rem Kim11mo ago
I fixed it by adding railway.json and pinning nixpack version
angelo
angelo11mo ago
Woohoo, again, sorry that you faced this issue - rough patch on the Node 16 LTS EOL Locking thread.