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.
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!
Thanks! That is really helpful!!
It's helpful!, thanks