

Azure Static Web Apps: Node.js 16 and Oryx
source link: https://blog.johnnyreilly.com/2022/05/28/azure-static-web-apps-node-16-oryx
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Azure Static Web Apps: Node.js 16 and Oryx
Azure Static Web Apps presently fixes to Node.js 14 when building. If you require a different version of Node to build, this can be a problem. This post outlines a workaround.

The engine "node" is incompatible
As I was upgrading this blog to Docusaurus v2.0.0-beta.21 I noticed this error in my build:
error @docusaurus/[email protected]: The engine "node" is incompatible with this module. Expected version ">=16.14". Got "14.19.1"
error Found incompatible module.
---End of Oryx build logs---
Oryx has failed to build the solution.
Oryx, which performs the build for Static Web Apps, is fixed to Node 14 it seems. Or it may actually be that the GitHub Action is fixed to use Node.js 14 - I'm not completely sure. Either way, Docusaurus now requires Node 16. Frustratingly, the GitHub Action does not allow explicit configuration of the Node version. Happily, there is a way to resolve this - and it's pretty simple.
engines
to the rescue!
You can specify the node version you require in your package.json
with the engines
property. This means you can do something like this:
"engines": {
"node": ">=16"
}
And have the version of Node.js you require installed by Oryx.
Thanks to Cormac McCarthy for his comment which lead me to try this approach out.
You can see the PR where I made this change for my blog here.
Recommend
-
18
Azure Static Web Apps with .NET and Blazor Aaron...
-
25
SAFE Stack Web Apps on Azure Static Web AppsSAFE Stack Web Apps on Azure Static Web Apps - YouTube
-
8
david whitney, agile & software practices in londonDavid Whitney Azure Static Web Apps Are Awesome!
-
12
Copy link Collaborator dbrattli commented
-
5
Azure static web apps CLI, building apps locallySo, you have a frontend app, written in a SPA framework like Angular, React, Vue or maybe Svelte? And you want to find the quickest way to get it to the Cloud? There are many ways to do so, GitH...
-
6
-
12
How to create your personal blog with Gatsby & Azure Static Web Apps – Azure Tips & Tricks
-
3
NuGet Gallery Status Find out the service status of NuGet.org and its related services. ...
-
3
Home
-
5
This post will cover common scenarios you may encounter when deploying a PHP application on App Service Linux while Oryx is the builder. Identify the build provider It is very important to identify...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK