Deploying Typescript + Angular app to Azure App Service via Azure Devops pipeline (ng modue not found)

abc123321cba 0 Reputation points
2024-01-19T14:31:26.8233333+00:00

Hi Everyone,

Got this typescript + angular app that works great locally. Trying to set up a deployment pipeline on Azure Devops that builds and releases to App Service (linux nodejs webapp). The plumbing works, the whole pipeline succeeds - both the build and release stages. However, I cannot get the deployed app to work - it has a 'ng module not found' error when it attempts 'npm start'. And that's that. What am I doing wrong? How to fix? Here's the yaml:

    # Node.js Express Web App to Linux on Azure
# Build a Node.js Express app and deploy it to Azure as a Linux web app.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

trigger: none

variables:

  # Azure Resource Manager connection created during pipeline creation
  azureSubscription: 'redacted'

  # Web app name
  webAppName: 'redacted'

  # Environment name
  environmentName: 'redacted'

  # Agent VM image name
  vmImageName: 'ubuntu-latest'

stages:
- stage: Build
  displayName: Build stage
  jobs:
  - job: Build
    displayName: Build
    pool:
      vmImage: $(vmImageName)

    steps:
    - task: NodeTool@0
      inputs:
        versionSpec: '14.x'
      displayName: 'Install Node.js'

    - script: |
        npm i -g -force @angular/cli@15.2
        npm i -force
        ng build --prod
      displayName: 'npm install etc'

    - task: ArchiveFiles@2
      displayName: 'Archive files'
      inputs:
        rootFolderOrFile: '$(System.DefaultWorkingDirectory)'
        includeRootFolder: false
        archiveType: zip
        archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
        replaceExistingArchive: true

    - upload: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
      artifact: drop

- stage: Deploy
  displayName: Deploy stage
  dependsOn: Build
  condition: succeeded()
  jobs:
  - deployment: Deploy
    displayName: Deploy
    environment: $(environmentName)
    pool:
      vmImage: $(vmImageName)
    strategy:
      runOnce:
        deploy:
          steps:
          - task: AzureWebApp@1
            displayName: 'Azure Web App Deploy: Redacted'
            inputs:
              azureSubscription: $(azureSubscription)
              appType: webAppLinux
              appName: $(webAppName)
              runtimeStack: 'NODE|14.x'
              package: $(Pipeline.Workspace)/drop/$(Build.BuildId).zip
              startUpCommand: 'npm start'


Cheers,

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
42,074 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. ManoharLakkoju 700 Reputation points Microsoft Vendor
    2024-01-22T04:08:58.4566667+00:00

    @abc123321cba
    Welcome to Microsoft Q&A Platform, thanks for posting your query here. Azure DevOps related queries/issues are currently not supported on this Microsoft Q&A platform. I would request you to please post your queries in dedicated forums as in below links: https://developercommunity.visualstudio.com/spaces/21/index.html https://developercommunity.visualstudio.com/t/get-unique-id-from-devops-organization/756710 https://stackoverflow.com/questions/tagged/azure-devops

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.