Ayan-8986 avatar image
0 Votes"
Ayan-8986 asked Ayan-8986 commented

azure app nodejs simple deployment

I have followed the basic steps to create an app service and chose the free tier.

Next I used az shell to create a simple nodejs app locally [no git]

I then used az webapp up -n app -g rg

deployment done

app does not work. Says module "express" not found.

locally the npm install is done - node modules exist; npm start works.

see log extract

2021-10-27T04:48:54.382478485Z /
2021-10-27T04:48:54.382489885Z / /
\ _ / | _ _/ \
2021-10-27T04:48:54.382496185Z / | \/ /| | /| | \/\
2021-10-27T04:48:54.382502785Z _
| / _/ || ___ >
2021-10-27T04:48:54.382509285Z \/ \/ \/
2021-10-27T04:48:54.382558485Z A P P S E R V I C E O N L I N U X
2021-10-27T04:48:54.382570886Z Documentation:
2021-10-27T04:48:54.382576986Z NodeJS quickstart:
2021-10-27T04:48:54.382582886Z NodeJS Version : v10.14.2
2021-10-27T04:48:54.382588686Z Note: Any data outside '/home' is not persisted
2021-10-27T04:48:54.596817410Z Cound not find build manifest file at '/home/site/wwwroot/oryx-manifest.toml'
2021-10-27T04:48:54.596860310Z Could not find operation ID in manifest. Generating an operation id...
2021-10-27T04:48:54.597011411Z Build Operation ID: 44ef5cdf-bfb8-47f6-9d17-ecc992542a87
2021-10-27T04:48:56.231508274Z Environment Variables for Application Insight's IPA Codeless Configuration exists..
2021-10-27T04:48:56.500931240Z Writing output script to '/opt/startup/'
2021-10-27T04:48:57.238400334Z Running #!/bin/sh
2021-10-27T04:48:57.238593336Z # Enter the source directory to make sure the script runs where the user expects
2021-10-27T04:48:57.238609036Z cd "/home/site/wwwroot"
2021-10-27T04:48:57.238759837Z export NODE_PATH=/usr/local/lib/node_modules:$NODE_PATH
2021-10-27T04:48:57.239149140Z if [ -z "$PORT" ]; then
2021-10-27T04:48:57.239327541Z export PORT=8080
2021-10-27T04:48:57.239489642Z fi
2021-10-27T04:48:57.239762544Z npm start
2021-10-27T04:48:58.027894232Z npm info it worked if it ends with ok
2021-10-27T04:48:58.027937633Z npm info using npm@6.14.10
2021-10-27T04:48:58.028046033Z npm info using node@v10.14.2
2021-10-27T04:48:58.362777108Z npm info lifecycle nodeapp@1.0.0~prestart: nodeapp@1.0.0
2021-10-27T04:48:58.369166153Z npm info lifecycle nodeapp@1.0.0~start: nodeapp@1.0.0
2021-10-27T04:48:58.371874572Z > nodeapp@1.0.0 start /home/site/wwwroot
2021-10-27T04:48:58.371882972Z > node app
2021-10-27T04:48:58.529620391Z internal/modules/cjs/loader.js:583
2021-10-27T04:48:58.529661792Z throw err;
2021-10-27T04:48:58.529679892Z ^
2021-10-27T04:48:58.529692092Z Error: Cannot find module 'express'
2021-10-27T04:48:58.529697592Z at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
2021-10-27T04:48:58.529703092Z at Function.Module._load (internal/modules/cjs/loader.js:507:25)
2021-10-27T04:48:58.529708492Z at Module.require (internal/modules/cjs/loader.js:637:17)
2021-10-27T04:48:58.529714492Z at require (internal/modules/cjs/helpers.js:22:18)
2021-10-27T04:48:58.529720292Z at Object.<anonymous> (/home/site/wwwroot/app.js:1:77)
2021-10-27T04:48:58.529726592Z at Module._compile (internal/modules/cjs/loader.js:689:30)
2021-10-27T04:48:58.529732592Z at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
2021-10-27T04:48:58.529738892Z at Module.load (internal/modules/cjs/loader.js:599:32)
2021-10-27T04:48:58.529744792Z at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
2021-10-27T04:48:58.529752092Z at Function.Module._load (internal/modules/cjs/loader.js:530:3)
2021-10-27T04:48:58.537555848Z npm info lifecycle nodeapp@1.0.0~start: Failed to exec start script
2021-10-27T04:48:58.542616783Z npm ERR! code ELIFECYCLE
2021-10-27T04:48:58.542640584Z npm ERR! errno 1
2021-10-27T04:48:58.544107094Z npm ERR! nodeapp@1.0.0 start: node app
2021-10-27T04:48:58.545147501Z npm ERR! Exit status 1
2021-10-27T04:48:58.546311710Z npm ERR!
2021-10-27T04:48:58.548340324Z npm ERR! Failed at the nodeapp@1.0.0 start script.
2021-10-27T04:48:58.549321631Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-10-27T04:48:58.584475780Z npm WARN Local package.json exists, but node_modules missing, did you mean to install?
2021-10-27T04:48:58.586637196Z npm timing npm Completed in 604ms
2021-10-27T04:48:58.586669196Z npm ERR! A complete log of this run can be found in:
2021-10-27T04:48:58.586674996Z npm ERR! /root/.npm/_logs/2021-10-27T04_48_58_550Z-debug.log

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for asking question! Just to confirm If you have deployed your files using FTP/S, ?

Node.js apps must be deployed with all the required NPM dependencies.
The App Service deployment engine automatically runs npm install --production for you when you deploy a Git repository, or a Zip package with build automation enabled.
But If you deploy your files using FTP/S, however, you need to upload the required packages manually.

By default, the deployment engine assumes that a ZIP package is ready to run as-is and doesn't run any build automation. To enable the same build automation as in a Git deployment, set the SCM_DO_BUILD_DURING_DEPLOYMENT app setting

Check this link:

Let us know.

0 Votes 0 ·

i am not using any ftp / ftps

the az webapp up command creates the zip - no errors in the deployment. The following is what I see when i execute the command

Creating zip with contents of dir /home/ayan/tmp ...
Getting scm site credentials for zip deployment
Starting zip deployment. This operation can take a while to complete ...
Deployment endpoint responded with status code 202
You can launch the app at
"URL": "",
"appserviceplan": "ASP-rg-affd",
"location": "centralus",
"name": "app",
"os": "Linux",
"resourcegroup": "rg",
"runtime_version": "node|10.14",
"runtime_version_detected": "0.0",
"sku": "FREE",
"src_path": "//home//ayan//tmp"

0 Votes 0 ·

0 Answers