Reputation: 6291
I am building a web app using Node. I started when version 4.0 of Node came out. When I run node -v
on my local machine, I see: "v4.0.0". I deployed the site as a Microsoft Azure Web App. However, that introduced a 500 error.
I looked at the logs, and I see the following:
Wed Sep 23 2015 13:29:20 GMT+0000 (Coordinated Universal Time): Unaught exception: SyntaxError: Unexpected reserved word
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (D:\home\site\wwwroot\routes\index.js:4:11)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
The line in question uses the class
keyword, which is allowed in Node 4.0. That prompted me to check the version of node running in my Azure Web App. From the console in Azure, I ran, node -v
again. Now I see, "v0.10.32".
How do I get Node 4.0 running for a Microsoft Azure Web App?
Upvotes: 0
Views: 121
Reputation: 1294
specify the version in your "engines" directive in package.json
{
"engines":{"node":4.0.0}
}
more info about specifying versions here: https://azure.microsoft.com/en-us/documentation/articles/nodejs-specify-node-version-azure-apps/
Upvotes: 2