0

in my node js web app, i use node version = 6.9.1:

  "engines": {
    "node": "6.9.1"
  }

and when i do deployment with

git push azure master

it shows correct node is used.

...
remote: Selected node.js version 6.9.1. Use package.json file to choose a different version.
remote: Selected npm version 3.10.8
...

but my app service is not started correctly because of node.exe crashed. later i output the used node version number in my entry point script, i get

Node version:v0.6.20

from file D:\home\LogFiles\Application\xxxx-stdout-xxxx.txt

so obviously Azure App service is not using my defined version of node.exe.

later i follow https://learn.microsoft.com/en-us/azure/nodejs-specify-node-version-azure-apps

add below text in file D:\home\site\wwwroot\iisnode.yml to fix this issue.

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

so my question is why Azure App Service (iisnode) is not using my defined node version in package.json ?

Redman
  • 642
  • 1
  • 5
  • 16
  • That's odd. It should automatically create the iisnode.yml in that case. If you can [share a minimal repro](https://github.com/projectkudu/kudu/wiki/Using-a-git-repo-to-report-an-issue), I'll take a look. – David Ebbo Nov 20 '17 at 16:41
  • Possible duplicate of https://stackoverflow.com/questions/28257861/azure-website-instance-not-running-defined-node-version-in-package-json – ShadSterling Apr 22 '18 at 05:26

1 Answers1

1

To change the NodeJs version of Azure App Service by using iisnode.yml(which won’t change node version on kudu cli or during deployment), you need to set iisnode.yml file manually in your app root folder with including below line as you have mentioned: nodeProcessCommandLine: "D:\Program Files (x86)\nodejs\5.9.1\node.exe"

Then you need to set iisnode.yml file using package.json during source control deployment. Azure Source Control deployment process would involve below steps 1. Moves content to azure web app 2. Creates default deployment script, if there isn’t one(deploy.cmd, .deployment files) in web app root folder 3. Run’s deployment script where it creates iisnode.yml file if you mention nodejs version in package.json file > engine

Reference: https://blogs.msdn.microsoft.com/azureossds/2016/04/20/nodejs-and-npm-versions-on-azure-app-services/.

Or else you can use App Settings in Azure portal to change the version of NodeJs.

  • 1
    finally I get rid of package.json && iisnode.yml, they are nightmares. I think use WEBSITE_NODE_DEFAULT_VERSION is the best solution. – Redman Sep 20 '18 at 02:44