I'm trying to deploy my Angular project with Azure DevOps. The build and deploy fase seem to go correctly judging by the green checkmarks for every stage. When I try to visit the webpage it shows the application error page with a link to the diagnostic resources.
The project is located on GitHub, during the build it gets pulled from there. Eventually after all tasks have been completed the app isn't launched and I get the following error in the diagnostic resources:
2019-10-04T11:19:47.004554842Z A P P S E R V I C E O N L I N U X
2019-10-04T11:19:47.004559742Z
2019-10-04T11:19:47.004564342Z Documentation: http://aka.ms/webapp-linux
2019-10-04T11:19:47.004569042Z NodeJS quickstart: https://aka.ms/node-qs
2019-10-04T11:19:47.004573843Z NodeJS Version : v10.10.0
2019-10-04T11:19:47.004578543Z
2019-10-04T11:19:47.065230218Z /opt/startup/init_container.sh: line 32: [: ==: unary operator expected
2019-10-04T11:19:47.108722107Z Oryx Version : 0.2.20190730.1, Commit: 4ef0d5854df39c57605e59bb6d255215cc85468a
2019-10-04T11:19:47.109454132Z
2019-10-04T11:19:47.115741747Z Cound not find build manifest file at '/home/site/wwwroot/oryx-manifest.toml'
2019-10-04T11:19:47.116226163Z Could not find operation ID in manifest. Generating an operation id...
2019-10-04T11:19:47.116765782Z Build Operation ID: d07e7783-8975-4038-8eaa-4e7987fbfe37
2019-10-04T11:19:47.890841571Z Writing output script to '/opt/startup/startup.sh'
2019-10-04T11:19:47.896506064Z Running #!/bin/sh
2019-10-04T11:19:47.897427996Z
2019-10-04T11:19:47.897445097Z # Enter the source directory to make sure the script runs where the user expects
2019-10-04T11:19:47.898696539Z cd "/home/site/wwwroot"
2019-10-04T11:19:47.898713540Z
2019-10-04T11:19:47.899855479Z if [ -z "$PORT" ]; then
2019-10-04T11:19:47.900292094Z export PORT=8080
2019-10-04T11:19:47.900308195Z fi
2019-10-04T11:19:47.901053620Z
2019-10-04T11:19:47.901069221Z npm start
2019-10-04T11:19:48.909373625Z
2019-10-04T11:19:48.909490829Z > appname@0.0.0 start /home/site/wwwroot
2019-10-04T11:19:48.909499129Z > ng serve
2019-10-04T11:19:48.909512530Z
2019-10-04T11:19:49.177294093Z internal/modules/cjs/loader.js:583
2019-10-04T11:19:49.177326694Z throw err;
2019-10-04T11:19:49.177333094Z ^
2019-10-04T11:19:49.177336894Z
2019-10-04T11:19:49.177340595Z Error: Cannot find module '../lib/init'
2019-10-04T11:19:49.177344395Z at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
2019-10-04T11:19:49.177348395Z at Function.Module._load (internal/modules/cjs/loader.js:507:25)
2019-10-04T11:19:49.177360595Z at Module.require (internal/modules/cjs/loader.js:637:17)
2019-10-04T11:19:49.177364695Z at require (internal/modules/cjs/helpers.js:20:18)
2019-10-04T11:19:49.177368396Z at Object. (/home/site/wwwroot/node_modules/.bin/ng:25:1)
2019-10-04T11:19:49.177372596Z at Module._compile (internal/modules/cjs/loader.js:689:30)
2019-10-04T11:19:49.177376196Z at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
2019-10-04T11:19:49.177379896Z at Module.load (internal/modules/cjs/loader.js:599:32)
2019-10-04T11:19:49.177383596Z at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
2019-10-04T11:19:49.177387196Z at Function.Module._load (internal/modules/cjs/loader.js:530:3)
2019-10-04T11:19:49.188853589Z npm ERR! code ELIFECYCLE
2019-10-04T11:19:49.190238236Z npm ERR! errno 1
2019-10-04T11:19:49.193511748Z npm ERR! appname@0.0.0 start: `ng serve`
2019-10-04T11:19:49.194584885Z npm ERR! Exit status 1
2019-10-04T11:19:49.196721058Z npm ERR!
2019-10-04T11:19:49.197268977Z npm ERR! Failed at the appname@0.0.0 start script.
2019-10-04T11:19:49.197998301Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-10-04T11:19:49.205773868Z
2019-10-04T11:19:49.206361388Z npm ERR! A complete log of this run can be found in:
2019-10-04T11:19:49.206880405Z npm ERR! /root/.npm/_logs/2019-10-04T11_19_49_199Z-debug.log
The YML file that is used for the build and deploy stages is as follows:
variables:
# 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: '10.x'
displayName: 'Install Node.js'
- script: |
npm install -g @angular/cli
npm install
npm run build
displayName: 'npm install and build'
- 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: appname'
inputs:
azureSubscription: $(azureSubscription)
appType: webAppLinux
appName: $(webAppName)
runtimeStack: 'NODE|10.10'
package: $(Pipeline.Workspace)/drop/$(Build.BuildId).zip
startUpCommand: 'npm start'
I've tried running other commands to reinstall npm or to drop the node_modules but that didn't resolve the issue. Please help since I'm clueless on how to make this work.