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
So let's go with 8.9.0 and on your Windows 10 where you do your development work, here are the steps:
- On Windows 10, launch PowerShell as Administrator.
npm i -g npm
wget https://nodejs.org/dist/v8.9.0/win-x64/node.exe -OutFile 'C:\Program Files\nodejs\node.exe'
Once done, you can verify with
If you encounter any problem, please consult
Next, let's update to the same version of NodeJS on Azure. Log on to https://portal.azure.com
- On the left menu, select App Services
- Select your NodeJS app
- Under Settings, select Application settings
- 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
- Don't forget to save
- Restart your app service, unfortunately.
- To verify, back to the Kudu console (https://[your-azure-app-name].scm.azurewebsites.net/DebugConsole), type