Search code examples
node.jsazureazure-web-app-serviceazure-application-settings

Node app in Azure App Service npm install timeout even for single packages no matter what, extremely unreliable


I have a standard Azure App Service and I'm trying to run a node rest api from it. I've had nothing but troubles from the very start.

Going into kudu to check what node versions are supported, the only supported node version listed is "nodejs":[{"version":"0.10.40" but I added the env variable where I specified node version 8.4 and it seems to be supported and when I run node --version it gives me 8.4 but that kudu config hasn't changed.

For some reason -- it doesn't install the packages right, I looked for 'body-parser' in the node_modules folder and it is not there even if its listed in package.json as direct dependency.

Running npm install or npm install body-parser all time-out with no real reason.

Running npm install as part of the devops release deployment cycle runs in 17 secondsbut it ends up saying 'up to date'

Judging by the mismatches between kudu's runtime file, the node version mismatch I think there's something seriously wrong with my app's config.

I'm running off a pay-as-you-go subscription using the Basic tier with 100 units.

This is a freshly installed app powering absolutely nothing.


Solution

  • First, please make sure that you have set the WEBSITE_NODE_DEFAULT_VERSION value in tab Application settings tab of your WebApp on Azure portal to enable the Node version what you want, as the figure below to use Node version 10.14.1.

    enter image description here

    Then, you can check it via commands node -v & npm -v in Kudu console.

    enter image description here

    I tried to install body-parser package in the directory node-test created by me via command npm install body-parser. Although there is some warn messages due to missing some files like package.json, the body-parser package has existed under the node-modules.

    enter image description here

    enter image description here