2

I created a Reactjs web app using the npx create-react-app and created an azure ci/cd pipeline to push the build folder to my Linux web app instance. i also specified startup command:

pm2 serve /home/site/wwwroot --no-daemon --spa

I verified that the build folder content is in the wwwroot folder but my Linux web app shows nothing.

my web app url: https://linux--dev.azurewebsites.net/ my web app content:

$ ls /home/site/wwwroot -al
total 37
drwxrwxrwx 2 nobody nogroup 4096 Mar 16 10:21 .
drwxrwxrwx 2 nobody nogroup    0 Mar 16 10:21 ..
-rwxrwxrwx 1 nobody nogroup 1092 Mar 16 10:21 asset-manifest.json
-rwxrwxrwx 1 nobody nogroup 3870 Mar 16 10:21 favicon.ico
-rwxrwxrwx 1 nobody nogroup 3010 Mar 16 10:21 index.html
-rwxrwxrwx 1 nobody nogroup 5347 Mar 16 10:21 logo192.png
-rwxrwxrwx 1 nobody nogroup 9664 Mar 16 10:21 logo512.png
-rwxrwxrwx 1 nobody nogroup  492 Mar 16 10:21 manifest.json
-rwxrwxrwx 1 nobody nogroup   67 Mar 16 10:21 robots.txt
drwxrwxrwx 2 nobody nogroup    0 Mar 16 10:21 static

2021-03-16T11:23:14.156072674Z   _____                               
2021-03-16T11:23:14.156107475Z   /  _  \ __________ _________   ____  
2021-03-16T11:23:14.156112975Z  /  /_\  \___   /  |  \_  __ \_/ __ \ 
2021-03-16T11:23:14.156116975Z /    |    \/    /|  |  /|  | \/\  ___/ 
2021-03-16T11:23:14.156120475Z \____|__  /_____ \____/ |__|    \___  >
2021-03-16T11:23:14.156124075Z         \/      \/                  \/ 
2021-03-16T11:23:14.156127375Z A P P   S E R V I C E   O N   L I N U X
2021-03-16T11:23:14.156130575Z 
2021-03-16T11:23:14.156133676Z Documentation: http://aka.ms/webapp-linux
2021-03-16T11:23:14.156136776Z NodeJS quickstart: https://aka.ms/node-qs
2021-03-16T11:23:14.156139976Z NodeJS Version : v14.15.1
2021-03-16T11:23:14.156143076Z Note: Any data outside '/home' is not persisted
2021-03-16T11:23:14.156146376Z 
2021-03-16T11:23:14.318873080Z Cound not find build manifest file at '/home/site/wwwroot/oryx-manifest.toml'
2021-03-16T11:23:14.318893181Z Could not find operation ID in manifest. Generating an operation id...
2021-03-16T11:23:14.318897181Z Build Operation ID: 9baf36d5-1dca-413f-929a-d66115f66772
2021-03-16T11:23:14.845130025Z Environment Variables for Application Insight's IPA Codeless Configuration exists..
2021-03-16T11:23:15.173100881Z Writing output script to '/opt/startup/startup.sh'
2021-03-16T11:23:15.352933180Z Running #!/bin/sh
2021-03-16T11:23:15.369142014Z 
2021-03-16T11:23:15.369169414Z # Enter the source directory to make sure the script runs where the user expects
2021-03-16T11:23:15.369175515Z cd "/home/site/wwwroot"
2021-03-16T11:23:15.369179015Z 
2021-03-16T11:23:15.369182315Z export NODE_PATH=/usr/local/lib/node_modules:$NODE_PATH
2021-03-16T11:23:15.369185715Z if [ -z "$PORT" ]; then
2021-03-16T11:23:15.369189115Z         export PORT=8080
2021-03-16T11:23:15.369192715Z fi
2021-03-16T11:23:15.369195915Z 
2021-03-16T11:23:15.369200215Z PATH="$PATH:/home/site/wwwroot" pm2 serve /home/site/wwwroot --no-daemon --spa
2021-03-16T11:23:15.381752696Z /opt/startup/startup.sh: 11: /opt/startup/startup.sh: pm2: not found

did I miss something?

gharbi.bdr
  • 147
  • 2
  • 9
  • do you see default file inside the wwwroot folder – Sajeetharan Mar 16 '21 at 02:16
  • No it's the build folder content. – gharbi.bdr Mar 16 '21 at 09:26
  • @gharbi.bdr How's your pipeline like? Did you publish the correct files? – Cece Dong - MSFT Mar 16 '21 at 09:47
  • @CeceDong-MSFT yea if i download the artifact i can run it locally with pm2 serve. the artifact is simply the build content. and is placed in my linux web app. so all my build files are located in the /home/site/wwwroot – gharbi.bdr Mar 16 '21 at 10:03
  • @gharbi.bdr Have you check the project in the Kudu console? Your project exists or not? – Cece Dong - MSFT Mar 16 '21 at 10:08
  • @CeceDong-MSFT i logged in the app service using kudu and verified that my artifact content is in the rights place. – gharbi.bdr Mar 16 '21 at 10:10
  • @CeceDong-MSFT as soon as i run my ci/cd the app service shows "Application Error" https://linux--dev.azurewebsites.net/ – gharbi.bdr Mar 16 '21 at 10:25
  • If my reply is helpful, please accept it as answer(click on the mark option beside the reply to toggle it from greyed out to fill in.), see https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work – Jason Pan Mar 18 '21 at 07:12

1 Answers1

4

Try to use npx serve -s in your startup command.

enter image description here

It works for me.

enter image description here

enter image description here

Jason Pan
  • 15,263
  • 1
  • 14
  • 29