3
votes

My project is failing to install in azure. I suspect that Azure is using the wrong version of node and dying.

My setup: 1) Azure portal, app setting, added WEBSITE_NODE_DEFAULT_VERSION 8.9.1 2) Also, added "engines":{"node": "8.9.3"}, to package.json

When I select console in from Azure portal, development tool:

node -v
D:\home\site\wwwroot
v0.10.40

The kudu page https://purple01.scm.azurewebsites.net/Env.cshtml reports a path with both the correct and not correct version of node.

Path = D:\Program Files (x86)\SiteExtensions\Kudu\70.10102.3204\bin\NativeBinaries/amd64;D:\home\site\deployments\tools;D:\Program Files (x86)\SiteExtensions\Kudu\70.10102.3204\bin\Scripts;D:\Program Files (x86)\MSBuild\14.0\Bin;D:\Program Files (x86)\Git\cmd;D:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow;D:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn;D:\Program Files (x86)\Microsoft SDKs\F#\3.1\Framework\v4.0;D:\Program Files (x86)\Git\bin;D:\Program Files (x86)\Git\usr\bin;D:\Program Files (x86)\Git\mingw32\bin;D:\Program Files (x86)\nodejs\0.10.28;D:\Program Files (x86)\npm\1.4.28;C:\DWASFiles\Sites#1purple01\AppData\npm;D:\Program Files (x86)\bower\1.7.9;D:\Program Files (x86)\grunt\0.1.13;D:\Program Files (x86)\gulp\3.9.0.1;D:\Program Files (x86)\funcpack\0.2.2;D:\Program Files (x86)\nodejs\8.9.1;D:\Windows\system32;D:\Windows;D:\Windows\System32\Wbem;D:\Windows\System32\WindowsPowerShell\v1.0\;D:\Program Files (x86)\Git\cmd;D:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;;D:\Program Files (x86)\dotnet;D:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps;D:\Program Files (x86)\PHP\v5.6;D:\Python27;

The only error reported is in a file found on ftp://waws-prod-sn1-053.ftp.azurewebsites.windows.net/LogFiles/Application/logging-errors.txt

Sat Jan 13 2018 00:53:57 GMT+0000 (Coordinated Universal Time): Application has thrown an uncaught exception and is terminated:
SyntaxError: Use of const in strict mode.
    at Module._compile (module.js:434:25)
    at Object..js (module.js:464:10)
    at Module.load (module.js:353:31)
    at Function._load (module.js:311:12)
    at Module.require (module.js:359:17)
    at require (module.js:375:17)
    at Object.<anonymous> (D:\Program Files (x86)\iisnode\interceptor.js:459:1)
    at Module._compile (module.js:446:26)
    at Object..js (module.js:464:10)
    at Module.load (module.js:353:31)
Sat Jan 13 2018 02:17:45 GMT+0000 (Coordinated Universal Time): Application has thrown an uncaught exception and is terminated:
SyntaxError: Use of const in strict mode.
    at Module._compile (module.js:434:25)
    at Object..js (module.js:464:10)
    at Module.load (module.js:353:31)
    at Function._load (module.js:311:12)
    at Module.require (module.js:359:17)
    at require (module.js:375:17)
    at Object.<anonymous> (D:\Program Files\iisnode\interceptor.js:459:1)
    at Module._compile (module.js:446:26)
    at Object..js (module.js:464:10)
    at Module.load (module.js:353:31)

Not sure if this error is my code failing or Azure code failing. My code does use strict and a bunch of new stuff like promises. So I need a current version of node.

Any suggestions as to what is wrong with the Azure setup?

1

1 Answers

6
votes

There is no Node 8.9.1 installed on App Service so it defaults to whatever the default is (apparently 0.10.40).

You can see a list of available (installed) Node engines here - https://{sitename}.scm.azurewebsites.net/api/diagnostics/runtime

Change WEBSITE_NODE_DEFAULT_VERSION to read 8.9.3 and you should be good.

Test with node -v in Kudu:

Kudu DebugConsole

By the way, you can look at the log stream here, no need to throw FTP at the problem - https://{sitename}.scm.azurewebsites.net/api/logstream

There's also a Log Stream blade under your Web App in the Azure Portal that connects to the same endpoint:

enter image description here