1

Problem: I have a project with a server (Express Server that handles file uploading and deleting) and client (Front End Create-React-App). The project structure looks like follows:

Root Folder With Server

Client Folder

Each folder has it's own package.json. Server Package.json. Client package.json

I'm trying to build and deploy onto azure however the pipeline hangs on "npm install and build".

It seems like the build succeeds but this phase just hangs. Here is my server.js (the routes are not included) file and yaml file just in case.

I'd appreciate any kind of help. Thank you!

ksulli
  • 13
  • 3
  • It is recommended to visit the website and view the logs in the portal. Provide more error information, which is conducive to the handling of problems. – Jason Pan Jul 14 '20 at 07:52
  • https://stackoverflow.com/questions/62758223/how-to-deploy-an-azure-webapp-nodejs/62771174#62771174 – Jason Pan Jul 14 '20 at 07:54
  • Hi Jason, I'm creating a pipeline in azure devops and it doesn't actually return an error. It checks out my git repo, fetches everything successfully, installs node, then tries to npm install and build. It successfully installs and even builds a folder. It just doesn't exit this phase and keeps trying to finish this phase/process and the contents aren't pushed to a static web app. This is my link that I'd like to have my web contents hosted on but it's just the base template. https://ambitious-island-042e37300.azurestaticapps.net/. – ksulli Jul 14 '20 at 23:29
  • Is my answer useful to you, do you need further help? – Jason Pan Jul 20 '20 at 09:54
  • @ksulli Not get your latest information, is ason Pan's answer helpful for you? Or if you have any concern, feel free to share it here. – Hugh Lin Jul 21 '20 at 07:04
  • Hi @JasonPan, sorry for getting back to you late (back at work after a break), I will try these troubleshooting suggestions and will let you know if they worked by the end of the day. Locally my program works fine is something I can say for now. – ksulli Jul 23 '20 at 01:23
  • @ksulli If there are other problems during the operation, please provide the error message in the Action. Hope it can help you and good luck! – Jason Pan Jul 23 '20 at 01:26
  • Hi Jason, I tried deploying through deployment centre and it actually went through the release pipeline! So that's a big step. Just the actual website displays not found so I think I need to configure the settings so it also builds and creates the website. (http://travelsnow.azurewebsites.net/) I'll update this once I try some more stuff out. Thanks again Jason. – ksulli Jul 23 '20 at 07:55

1 Answers1

0

Troubleshooting suggestions:

  1. In the case of ensuring that the code in github is consistent with the local code, if an exception occurs, it is recommended to replace the linux platform and redeploy.

  2. It is recommended to use my suggestion to recreate the repository, and then check the Action status in github.

Sum up:

In general, it is more appropriate to use Linux in azure than windows. For example, Linux supports npx, and may also support other packages and commands. When the local code can run normally, there is generally no problem when deploying to github, unless there may be modifications, which we have ignored. So make sure the code is consistent.

General correct deployment steps:

  1. First in the portal, make sure to create a web app application (not a static web app), and select the node environment.

  2. Make sure that the sever program can run normally locally. Create a new repository in github.

    ->git init

    ->git add.

    ->git commit -m'init'

    ->git remote add origin https://github.com/{your name}/newAppname.git

    ->git push -u origin master

  3. Connect in the Portal's Deployment center.

enter image description here

  1. Then check the status of Action in github.
Jason Pan
  • 15,263
  • 1
  • 14
  • 29