How to fix version mismatch between runtime node version and actual node version

Mohamed Elsagh 0 Reputation points
2023-12-03T23:20:20.18+00:00

These are the settings on my web appUser's image

However my deployments were never successful. Then I find this on the websites' bash:
User's image

How is that the case? And how do I fix this? I never specified v18 in any of my work on this webapp, not once.

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,173 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 30,281 Reputation points Microsoft Employee Moderator
    2023-12-06T04:06:44.06+00:00

    @Mohamed Elsagh

    Check your package.json or local node version. It may be referring to an older version of node. You'll notice I created a web app using Node 20 but was changed to match the runtime version on my local machine. To fix, make sure your local environment and package.json is using Node 20.

    appsvclinux ssh host

    vscode terminal

    --

    EDIT 2023 Dec 6 Based off your I'm updating my answer. I have verified the following steps do indeed work.

    1. Set the runtime in either the portal or run az webapp config set --name <app name> --resource-group <resource group> --linux-fx-version "NODE|20-lts". If using PowerShell, use --% to escape the | in --linux-fx-version argument.
    2. Restart the app service either via portal or az webapp restart --name <app name> --resource-group <resource group>

    When you start a new SSH session, you should see the NodeJS version updated upon the start of the session.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.