DEV Community

Kevin Le
Kevin Le

Posted on • Updated on

Updating local(Windows10) and Azure NodeJS version and keep them in sync

There will come a time when we all have to update to the latest or stable NodeJS version. This is not something I do every day or every week or even every month so I tend to forget how I did it the last time. My memory is not that good. Developing with NodeJS on a Windows 10 and hosting production on Azure just make the task a little bit more daunting for me. So this time, I decide to document. Hopefully this will help the future me and you.

First, we have to determine what version of NodeJS we want. As a side note, we don't always want the 'latest'. If you want long-term support version (LTS), choose an even-numbered version such as 6.x.y, or 8.x.y, etc. But we have to make sure that whichever version we choose, it's supported by Azure.

Go to https://nodejs.org/download/release/ and you will see all NodeJS versions that have been released. At the time of this article, version 9.3.0 is the latest, but 8.9.3 is the last one in the 8.x series.

However, we can't simply go with 8.9.3, because again at the time of this writing, Azure only supports up to 8.9.0. The way we can figure out is to go to https://[your-azure-app-name].scm.azurewebsites.net/DebugConsole/, then at the console, type command

ls D:\"Program Files (x86)"\nodejs

Azure NodeJS version

So let's go with 8.9.0 and on your Windows 10 where you do your development work, here are the steps:

  1. On Windows 10, launch PowerShell as Administrator.
  2. Type command

    npm i -g npm

  3. Type command

    wget https://nodejs.org/dist/v8.9.0/win-x64/node.exe -OutFile 'C:\Program Files\nodejs\node.exe'

  4. Once done, you can verify with

    node -v

If you encounter any problem, please consult
https://stackoverflow.com/a/39602646/1244013

Next, let's update to the same version of NodeJS on Azure. Log on to https://portal.azure.com

  1. On the left menu, select App Services
  2. Select your NodeJS app
  3. Under Settings, select Application settings
  4. Scroll down to App Settings on a new blade that pops up, find WEBSITE_NODE_DEFAULT_VERSION and change from whatever to 8.9.0 WEBSITE_NODE_DEFAULT_VERSION Application Settings
  5. Don't forget to save
  6. Restart your app service, unfortunately.
  7. To verify, back to the Kudu console (https://[your-azure-app-name].scm.azurewebsites.net/DebugConsole), type node -v

Top comments (0)