My web app on linux is running the wrong version of node.js

David Ramer 1 Reputation point
2025-05-15T14:59:47.4933333+00:00

My web app is running the wrong version of Node? Every time I deploy Log stream says I'm running node 14? and then in server.js my app dies... I need to be running Node 22 LTS? Here is what. I've done.

Package.json has engine node 22

I've set the stack in configuration to node 22

I've set the custom app variable to node 22.5.1

Configure a Node.js app for Azure App Service by using cloud shell

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,932 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Harshitha Veeramalla 1,301 Reputation points Microsoft External Staff Moderator
    2025-05-16T12:23:27.5233333+00:00

    Hi @David Ramer,

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same can easily reference this!

    Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.

    Issue :

    Web app on linux is running the wrong version of node.js

    Steps taken:

    • Specified Node.js version 22 in package.json under the engines field.
    • Set a custom application setting to use Node.js version 22.5.1.
    • Configured the App Service stack to Node.js 22 in the Azure portal.

    Solution :

    The issue was caused by using the incorrect format for specifying the Node.js version in the --linux-fx-version setting.

    In Azure CLI command use NODE|22-lts instead of NODE | 22LTS.

    
    az webapp config set --name AppName --resource-group RGName --linux-fx-version "NODE|22-lts"
    
    

    To align the KUDU environment with the specified Runtime stack version.

    • Update the engines setting in package.json as shown below
    {
      "name": "ProjectName",
      "version": "1.0.0",
      "engines": {
        "node": "22.0.0",
        "npm": "10.0.0"
      }
    }
    

    Please click Accept Answer and kindly upvote it so that other people who faces similar issue may get benefited from it.

    0 comments No comments

  2. David Ramer 1 Reputation point
    2025-05-19T15:34:55.2566667+00:00

    Here is the problem.... I think... This has taken me 7 days to figure out. when you set the node version I was using the display name. NODE | 22LTS that does not work.... I think what works is:

    NODE|22-lts
    

    I found this on the internet from another poor slob with the same issue

    az webapp config set \
                      --name $(webAppName) \
                      --resource-group testifyAI_group_v2 \
                      --linux-fx-version "NODE|22-lts"
    

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.