JMK
JMK

Reputation: 28079

Upgrading Node on an Azure website?

I'm trying to run some pre deployment tasks (unit tests etc) with NPM on an Azure website, however the version of node on the VM is v0.10.32, the current version of node is v4.2.4.

I have non administrative access to the command line via the SCM website, no RDP etc.

Is there any way to upgrade?

Upvotes: 23

Views: 22087

Answers (5)

Asbjørn Ulsberg
Asbjørn Ulsberg

Reputation: 8820

For me, the solution was neither to set the engine version in package.json, nor to set WEBSITE_NODE_DEFAULT_VERSION, but to use the az command line as described here:

az webapp config set \
  --resource-group <resource-group-name> \
  --name <app-name> \
  --linux-fx-version "NODE|14-lts"

Upvotes: 0

Wlad Neto
Wlad Neto

Reputation: 381

Changing NodeJs Version in Azure Portal

Navigate to your web app in azure portal Click on Application settings in Settings blade. You can include WEBSITE_NODE_DEFAULT_VERSION as key and version of nodejs you want as value in app settings.

Example: WEBSITE_NODE_DEFAULT_VERSION 8.0.0

Upvotes: 12

Pavel Kovalev
Pavel Kovalev

Reputation: 8166

2017 update. All above didn't work for me in.

I changed:

// package.json
engines":{"node": "8.0.0"}

and then I added app settings value

<appSettings>
    <add key="WEBSITE_NODE_DEFAULT_VERSION" value="8.0.0" />
</appSettings>

I restarted an app million times, and the solution was to change iisnode.yml

nodeProcessCommandLine: "D:\Program Files (x86)\nodejs\8.0.0\node.exe"

That's it. I hope it will help someone.

Update

Just to clarify things: I'm talking about App Service App Service Image

And if you ftp to your App you will see iisnode.yml here:

iisnode.yml on ftp

Upvotes: 14

Shaun Luttin
Shaun Luttin

Reputation: 141702

Ensure the Azure Web App has the node version you want.

  1. Go to yoursite.scm.azurewebsites.net
  2. Choose Debug Console (PowerShell or CMD)
  3. Navigate to D:\Program Files (x86)\nodejs
  4. Run dir to see the available nodejs versions.

For instance, if there is a directory named 6.3.0, then you can use it.

// App Setting
WEBSITE_NODE_DEFAULT_VERSION 6.3.0  

// package.json
engines":{"node": "6.3.0"}

Upvotes: 31

Martin Beeby
Martin Beeby

Reputation: 4599

You can specify the version of node that the app is running on using the package.json file. Add:

"engines":{"node":version}

e.g.:

"engines":{"node": "0.12.x"}, 

More info: https://azure.microsoft.com/en-us/documentation/articles/nodejs-specify-node-version-azure-apps/

Upvotes: 17

Related Questions