As a follow-up on the presentation I did at CloudBrew about Azure Static Web Apps I want to write a series of blog posts.
- Part I - Using the VS Code Extension
- Part II(this post) - Using the Astro Static Site Generator
Yesterday I showed you how to deploy your first Static Web App using the VSCode extension. As an example I used a static website created using Astro.
What I didnāt mention is that the first time the Github Actions workflow tried to build and deploy the application it failed with the following error message:
Build error:
Node.js v16.20.2 is not supported by Astro!
Please upgrade Node.js to a supported version: ">=18.14.1"
The problem is that the Github Action that is created by the extension assumes the use of node 14. As Astro requires a more recent Node.js version the Astro build fails. To resolve this we need to update our package.json
to explicitly specify a node version by adding an engines
section:
{ | |
"name": "astro-landing-page", | |
"type": "module", | |
"version": "0.0.1", | |
"private": true, | |
"scripts": { | |
"dev": "astro dev", | |
"start": "astro dev", | |
"build": "astro build", | |
"preview": "astro preview", | |
"astro": "astro", | |
"format": "prettier --write **/*.astro .", | |
"clean": "rimraf dist .astro node_modules" | |
}, | |
"engines": { | |
"node": ">=18.0.0" | |
}, | |
"devDependencies": { | |
"@astrojs/tailwind": "^5.0.2", | |
"@azure/static-web-apps-cli": "^1.1.6", | |
"@types/micromodal": "^0.3.3", | |
"astro": "^3.3.0", | |
"astro-icon": "^0.8.1", | |
"prettier": "^3.0.3", | |
"prettier-plugin-astro": "^0.12.0", | |
"prettier-plugin-tailwindcss": "^0.5.6", | |
"rimraf": "^5.0.5", | |
"tailwindcss-fluid-type": "^2.0.3" | |
}, | |
"dependencies": { | |
"@fontsource-variable/inter": "^5.0.13", | |
"micromodal": "^0.4.10", | |
"sharp": "^0.32.6", | |
"tailwindcss": "^3.3.3", | |
"tiny-invariant": "^1.3.1" | |
} | |
} |