Updated 2020-04-06: there is now an official way to have 64-bit Node.js on your Windows-based App Service in Azure. Seeing a post by Jessica Deen triggered me to update this post.
The Azure DevOps pipeline for this blog broke yesterday, and during investigation I noticed something strange. Azure DevOps uses a 64-bit Node.js to build my blog, but it gets deployed to an Azure App Service that runs 32-bit Node.js.
Normally, this doesn't really pose an issue, but in some cases (when using packages that get natively build with node-gyp and N-API for example) an application built on 64-bit doesn't run on a 32-bit Node.js binary.
When I was setting up this blog, I already investigated switching to Node.js 64-bit in my Azure App Service but this wasn't supported at the time. Even if the App Service would be configured to run 64-bit, it would still use a Node.js 32-bit install and no 64-bit installs were provided out of the box.
So I decided to see if things had changed over the past few months.
Azure App Service
A bit of Googling showed multiple GitHub issues and UserVoice requests to have Node.js 64-bit in a 64-bit App Service and Function Apps etc., going back 3 years even.
Buried in one of this GitHub issues Marie Hoeger mentioned that they now have one Node.js version (10.15.2) deployed on the App Services, although it seems this is more for internal testing and she is a bit vague about the support state. In another GitHub issue Marie Hoeger describes the official way to achieve our goal.
If you'd still want to try it out you need to tweak your App Service a bit:
- Switch your App Service to use 64-bit. Open Azure Portal, go to App Service -> Configuration -> General settings -> Platform settings. From the dropdown, select 64-bit.
- Adjust the App Service Application settings. Open Azure Portal, go to App Service -> Configuration -> Application settings.
Add or update the keyAdd or update the key
D:\Program Files\nodejs\10.15.2. This is the path to the 64-bit binary of Node.js in your App Service.
Kudu deployment engine
For some reason, the Kudu deployment engine ignores the
WEBSITE_NODE_DEFAULT_VERSION and always falls back to a deprecated Node.js 6.x version. You might want to make an additional change if you use the Kudu deployment engine to continuously deploy your Git repository.
udu can be easily convinced to use a different Node.js version by adding an additional Application setting to your App Service: Open Azure Portal, go to App Service -> Configuration -> Application settings. Add or update the key
languageWorkers:node:defaultExecutablePath to value
Your next deployment will now use a more recent version of Node.js!
This is now no longer relevant 😀.
I'm not sure how supported this is, so use at your own risk. There is (as far as I know) no other official documentation describing this, and at the time of writing only one version of Node.js is installed. Both might be indicators that this is still an experiment but for now my blog seems to be humming on happily 😉.
My blog is still humming on happily, now in a more supported fashion 😉.