Problem
Azure Static Web App creates a GitHub Action that uses Oryx to build your web app. I have a React App that uses node.js to build. However, the default version of node Oryx is using is currently 14.x. I would like to use version 16.x for building my App.
In the build log of GitHub Action, you can see node version 14.x is being used.
Solution
Unlike what you usually do with YAML build definitions. There's no parameter for node versions in Azure/static-web-apps-deploy@v1 action currently.
We must edit our project's package.json
to specify a node version. Add the following code into your package.json
file.
"engines": {
"node": ">=16.0.0"
}
Now, the build will use Node.js 16.x.
Siddharth Abbineni
Oh my god! Thank you so much! I was banging my head on how to get node>16 to work with this. I tried adding extra steps in the yaml to manually set 16 and that didn't work either. This worked perfectly and my site is not deployed! Thanks!
Komatzu
Thanks! That is really helpful!!
Thada
It's helpful!, thanks
Rado Robes
Hi guys, I'm trying to deploy application to azure, but i'm struggling with this issue
error @nicky-lenaers/ngx-scroll-to@14.0.0: The engine "yarn" is incompatible with this module. Expected version ">=1.22.18". Got "1.22.15" error Found incompatible module.
I was trying to find out, if there is a way to upgrade yarn. With nodejs it worked fine, but cannot sort it out with yarn. Any idea how it could work? thanks a lot Rado
Cedric C
Thanks man !
Yke
Thanks, this worked like a charm. But it feels a bit hacky, let's hope it will be added in the Azure/static-web-apps-deploy@v1 action
Jose
Thanksss!!!!
Digital city
Thank you so much this has been useful :)
Tobias
Thank you! Was on the verge of giving up when I found this!
Aron
Thank you it helped out CI/CD start working again
ben
awesome thanks
Nick Bikker
Thank you! This is exactly what my problem was after they changed the newest Stableversion from node to 18.x instead of 16.x. Love you <3