Open jlous opened 11 months ago
Same problem. Here are logs https://github.com/rebeccapeltz/demo-azure-nextjs-client-server-static/actions
I am encountering the same problem when I try to deploy NextJS on static web apps: You are using Node.js 16.20.2. For Next.js, Node.js version >= v18.17.0 is required.
👍
Hey @thomasgauvin hope u doing great.
Are you guys actually planning to support Node 20?
Tks
Thanks all for the feedback on this, we'll be looking into this!
Hi folks, to be clear, this is referring to the runtime Node version being the limitation, not the build time Node version, correct?
Here's the log from a failed build : https://github.com/rebeccapeltz/demo-azure-nextjs-client-server-static/actions/runs/7188649410/job/19578699538#step:4:1
Hey @thomasgauvin,
Great news!
On my side, I'm pretty sure this is a runtime limitation indeed.
Looking forward to upgrade two apps into Node 20 🎉
@rebeccapeltz it appears that your build failed because it built the static & API content with Node 20 when you specified the engines in your package.json, despite Node 20 not yet being supported on SWA. Changing https://github.com/rebeccapeltz/demo-azure-nextjs-client-server-static/commit/7533560861a4553fc637da83f92b72b44a5e07fa from >=18.17.0 to 18.17.0 (or 18.17.1) would fix this, since it would use 18.17.0 instead of Node 20+
@michaelmccrae I would recommend following the specification of the engines in your package.json similarly to what Rebecca did above, specifying an engine of 18.17.0 (or 18.17.1)
@rafanoronha @jlous thanks for the feedback, yes we are looking to adopt Node 20 since it is now in preview in Azure Functions.
Thanks for the update @thomasgauvin 🙏
thanks @thomasgauvin going to the specific node version in package.json solved my issue:
"engines": {
"node": "18.17.1"
}
Thanks folks for the confirmation, let's keep this issue open until Node 20 rolls out! I will use this thread for any further updates
Thanks - it's working for me too. Much appreciated.
Do you have an ETA for node 20 support?
I followed this next.js documentation. By default, Build tools use Node.js 16 and similar error message.
https://learn.microsoft.com/en-us/azure/static-web-apps/deploy-nextjs-hybrid
And then I tried this method and successfully deploy to SWA. I hope to role out Node.js 20. https://github.com/Azure/static-web-apps/issues/1354#issuecomment-1897671568
@yannbolliger We don't have a timeline to share at this moment, but it's a work item slotted for our next semester
for me this one worked
"engines": {
"node": "18.19.1"
}
@thomasgauvin Do you have a public issue tracker, where the support for Node 20 can be followed - or any eta for the support to land?
Just add this code block in the azure-static-web-apps-your-id.yml file after actions/checkout@v3 but before Build And Deploy. Final preview:
env:
NODE_VERSION: '20.x'
jobs:
build_and_deploy_job:
runs-on: ubuntu-latest
name: Build and Deploy Job
steps:
- uses: actions/checkout@v3
with:
submodules: true
lfs: false
- name: Setup Node ${{ env.NODE_VERSION }} Environment
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@latest
Please add support for node 20, to keep up with Oryx and the world.
The current version of NextJs is 14, but it is barely possible to deploy: NextJs 14 requires node: '>=18.17.0', but if I specify that in my 'engines' section, Oryx selects 20.0.9, and static-web-apps fails with "Node version 20.9.0 is not supported. Please use one of the following versions 12, 14, 16, 18."
The single node version currently supported by both nextjs 14 and the platform is 18.17.1, and it has to be hard coded all the way But even that tiny window is closing:
Node 18 is entering maintenance mode as we speak (december 2023), and end-of-life in just 5 months. Nextjs release major versions every year, bumping the node requirement past any dead versions.
So this is a ticking bomb for anyone wanting to use new features of fixes in nextjs.