I'm using git to deploy a node.js app to Azure App Service. It returns
Service Unavailable
on the app page. In the console it shows
Failed to load resource: the server responded with a status of 503 (Service Temporarily Unavailable)
During the deployment I get one warning:
npm WARN lifecycle The node binary used for scripts is /usr/bin/node but npm is using /opt/nodejs/8.1.0/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
I included the option in scripts in package.json but it didn't solve it, perhaps it's the wrong place?
"start": "node server/server.js --scripts-prepend-node-path"
I've googled for an answer but couldn't solve it.
How to npm configuration options (such as --scripts-prepend-node-path) when deploying to azure web sites?
Setting WEBSITE_NODE_DEFAULT_VERSION to 8.1.0 in the environment variables didn't help. I have this node version specified in package.json.
I wasn't able to do a Custom Deployment Script as the second hint suggests.
I ran npm config set scripts-prepend-node-path true
locally in the project folder and then pushed but it didn't solve it.
Some other answers suggested that an app might need to be scaled up, but this one is handled well by Heroku free plan and here on Azure I have a student plan.
I'm including a part of the log I got:
Detecting node version spec...
Using package.json engines.node value: 8.1.0
Node.js versions available on the platform are: 4.4.7, 4.5.0, 6.2.2, 6.6.0, 6.9.3, 6.10.3, 6.11.0, 8.0.0, 8.1.0.
Resolved to version 8.1.0
Detecting npm version spec...
Using default for node 8.1.0: 5.0.3
NPM versions available on the platform are: 2.15.8, 2.15.9, 3.9.5, 3.10.3, 3.10.10, 5.0.3.
Resolved to version 5.0.3
Running "/opt/nodejs/8.1.0/bin/node" "/opt/npm/5.0.3/node_modules/npm/bin/npm-cli.js" install --production
npm WARN lifecycle The node binary used for scripts is /usr/bin/node but npm is using /opt/nodejs/8.1.0/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
npm WARN node_code@1.0.0 No description
updated 17 packages in 29.222s
npm WARN node_code@1.0.0 No repository field.
Finished successfully.
Diagnosing the app on Azure resulted in:
Failed Urls 50% of failures came from '/favicon.ico' path.
I would be really grateful if anyone could help me out with this, I'm new to such deployments. If I didn't provide some necessary data, please let me know.
Thank you