2 min read
Something to fix on ourside?


npm start to launch your application.nodemon in their start script for development convenience. While nodemon is great for watching changes in a local environment, it is not designed for production builds. When Azure tries to run it via GitHub Actions, the application fails to start correctly. nodemon is designed for development — it watches file changes and restarts your app locally. Azure does not support interactive watchers in production and expects a normal Node process (e.g., node index.js). This mismatch causes the app to exit immediately when deployed. node index.js and move nodemon to a separate "dev" command.
.github/workflows and open the .yml file (created automatically when you connected Azure to GitHub). id: deploy-to-webapp): - name: Set Azure startup command uses: azure/cli@v2 with: inlineScript: | az webapp config set \ --name <YOUR_APP_NAME> \ --resource-group <YOUR_RESOURCE_GROUP> \ --startup-file "node index.js"
name: Build and Deploy Node.js App on: push: branches: [main] jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '20.x' - name: Install dependencies run: npm install - name: Build (if any) run: npm run build --if-present - name: Set Azure startup command uses: azure/cli@v2 with: inlineScript: | az webapp config set \ --name <YOUR_APP_NAME> \ --resource-group <YOUR_RESOURCE_GROUP> \ --startup-file "node index.js" - name: Deploy to Azure uses: azure/webapps-deploy@v3 with: app-name: "<YOUR_APP_NAME>" publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} package: .
A full example of Github Actions YAML script to build and deploy Node.js to Azure App Service
