Configure Azure App Service for 64-bit platform and Node.js

Premier Developer

Premier

App Dev Manager Chris Tjoumas explains how to configure Azure Web App to run 64-bit Node.js. This is a follow-up to his previous post on deploying Ghost on Azure Web App.


In my previous post, I explained how to deploy Ghost on Azure Web App; however, Ghost v2.25.5 now requires Node.JS 64-bit to support the sharp package v0.22.1. If you followed my initial instructions to create the free App Service, you will notice that this build will break your post images. The sharp package is used to convert those posted images into optimized formats for performance. Without a functional sharp package, the Web App performance will be noticeably slower.

To fix this issue, you need to configure Azure Web App and Node.js to use 64-bit, which is only available in the App Service Basic Tier and above.

Configure Azure Web App to 64-bit Platform and Node.js:

  • Navigate to your Web App in the Azure Portal
  • Click on Configuration
  • Under Application settings, edit the WEBSITE_NODE_DEFAULT_VERSION and enter 10.15.2 and click Save

Machine generated alternative text: WEBSITE NODE DEFAULT VERSION 10.152

    1. You can identify the installed version by going to Kudu for your app (https://<your hostname>.scm.azurewebsite.net) and browsing to D:\Program Files\nodejs. You’ll see the version (64-bit since we are under “Program Files”) listed here. You can also go to https://<your hostname>.scm.azurewebsite.net/api/diagnostics/runtime to see the list of NodeJS versions that Azure Web App supports. For example, one of the versions listed for NodeJS is {“version”:”10.15.2″,”npm”:”6.4.1″}, which I’ll use here.
    2. Verify the node version by running the Kudu console and typing “node -v” (you should see 10.15.2, in this case)
  • Add WEBSITE_NPM_DEFAULT_VERSION and set the value to 6.4.1

Machine generated alternative text: WEBSITE NPM DEFAULT VERSION q 64.1

  • Click Save.
  • Click General settings and change Platform to 64 Bit

Platform settings Platform Bit

  • Click Save.
  • Jump over to your source code and edit iisnode.yml in the root by adding the following:

  • ¬†Finally, check in your change to kick-off a new build

Changing the Node.js version in this file will set the run-time environment which iisnode uses. The kudu command would use the Node.js version set in Application Settings, so it’s important to set both.

Navigate to your site and verify everything works! Now back to blogging (or fixing any apps which need 64-bit Node.js)!

Premier Developer
Premier Developer

Premier Support for Developers

Follow Premier   

2 comments

  • Avatar
    JasonDevComp

    Thank you!  One thing to note is that if you have a web.config with an <iisnode> tag then you need to define it like below.  App Services seems to ignore the iisnode.yml when you have the <issnode> tag on your web.config
    <iisnode watchedFiles=”web.config;*.js” debuggingEnabled=”false” nodeProcessCommandLine=”\Program Files\nodejs\10.15.2\node.exe” />

Leave a comment