We are trying to deploy a NodeJS app to Azure App Service (Linux) and if we deploy this from Visual Studio everything works fine and the site renders perfectly. Now we create a basic build/Release pipeline and deploying the zip file (Created from build) to the App services on Azure and then if we try to render the site it throws application error (Following is the log of the error):
> 2020-04-15T20:27:47.222887443Z > [email protected] start /home/site/wwwroot
2020-04-15T20:27:47.222895143Z > node ./bin/www
2020-04-15T20:27:47.222899943Z
2020-04-15T20:27:47.371119383Z internal/modules/cjs/loader.js:797
2020-04-15T20:27:47.371195483Z throw err;
2020-04-15T20:27:47.371942583Z ^
2020-04-15T20:27:47.371974683Z
2020-04-15T20:27:47.372042983Z ***Error: Cannot find module '/home/site/wwwroot/bin/www'
2020-04-15T20:27:47.372063083Z at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
2020-04-15T20:27:47.372103483Z at Function.Module._load (internal/modules/cjs/loader.js:687:27)
2020-04-15T20:27:47.372136083Z at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
2020-04-15T20:27:47.372176983Z at internal/main/run_main_module.js:17:11 {
2020-04-15T20:27:47.372206183Z code: 'MODULE_NOT_FOUND',***
2020-04-15T20:27:47.372292683Z requireStack: []
2020-04-15T20:27:47.372316483Z }
2020-04-15T20:27:47.402670091Z npm ERR! code ELIFECYCLE
2020-04-15T20:27:47.409661993Z npm ERR! errno 1
2020-04-15T20:27:47.411500494Z npm ERR! [email protected] start: `node ./bin/www`
2020-04-15T20:27:47.412151894Z npm ERR! Exit status 1
2020-04-15T20:27:47.412616894Z npm ERR!
2020-04-15T20:27:47.419115996Z npm ERR! Failed at the [email protected] start script.
2020-04-15T20:27:47.419849596Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-04-15T20:27:47.432179799Z
2020-04-15T20:27:47.432704699Z npm ERR! A complete log of this run can be found in:
2020-04-15T20:27:47.433290000Z npm ERR! /root/.npm/_logs/2020-04-15T20_27_47_420Z-debug.log
2020-04-15 20:27:48.453 ERROR - Container testexternalapp2_0_6702db49 for site testexternalapp2 has exited, failing site start
2020-04-15 20:27:48.464 ERROR - Container testexternalapp2_0_6702db49 didn't respond to HTTP pings on port: 8080, failing site start. See container logs for debugging.
What I found out is that whenever deployed from Visual Studio "./bin/www" is created and deployed on the App service but whenever deploying from Azure DevOps Release pipeline the "./bin/wwww" is missing and not available. Any help?
This is what I see from Log Stream when deployed from Visual Studio:
> /appsvctmp/volatile/logs/runtime/afbd672b48147e81a539c200a40b91607386719df21a7e51f842abbcd70c89db.log
2020-04-15T17:47:12.057871083Z: [INFO] echo "Done."
2020-04-15T17:47:12.057884183Z: [INFO] PATH="$PATH:/home/site/wwwroot" npm start
2020-04-15T17:47:13.285047383Z: [INFO] Found tar.gz based node_modules.
2020-04-15T17:47:13.295572890Z: [INFO] Removing existing modules directory from root...
2020-04-15T17:47:13.307481412Z: [INFO] Extracting modules...
2020-04-15T17:47:17.392564316Z: [INFO] Done.
2020-04-15T17:47:22.666823807Z: [INFO]
2020-04-15T17:47:22.666850507Z: [INFO] > [email protected] start /home/site/wwwroot
2020-04-15T17:47:22.666855308Z: [INFO] > node ./bin/www
2020-04-15T17:47:22.666858408Z: [INFO]
And When deployed from Azure DevOps this is what I see from the Logs:
2020-04-15T21:17:50.664112070Z npm ERR! errno 1
2020-04-15T21:17:50.664156869Z npm ERR! [email protected] start: `node ./bin/www`
2020-04-15T21:17:50.664174469Z npm ERR! Exit status 1
2020-04-15T21:17:50.664206269Z npm ERR!
2020-04-15T21:17:50.664220669Z npm ERR! Failed at the [email protected] start script.
2020-04-15T21:17:50.664251169Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-04-15T21:17:50.713658687Z
2020-04-15T21:17:50.713714987Z npm ERR! A complete log of this run can be found in:
2020-04-15T21:17:50.713837887Z npm ERR! /root/.npm/_logs/2020-04-15T21_17_50_672Z-debug.log