I am having a weird problem with trying to deploy a nodeJS API to and can't seem to find any realated issues Stack Overflow or Micorsoft. It is a simple teams bot API I am trying to deploy.
Things I've tried:
- Doing npm run build to make sure it builds. It does.
- Research where './util' is coming from cannot determine that ts-node does not appear to have this references to this either.
Azure Pipeline:
# 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://learn.microsoft.com/azure/devops/pipelines/languages/javascript
trigger:
- master
variables:
# Azure Resource Manager connection created during pipeline creation
azureSubscription: 'xx'
# Web app name
webAppName: 'appName-dev'
# Environment name
environmentName: 'appName-dev'
# 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
npm run build --if-present
displayName: 'npm install, build and test'
- 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: chatlink-dev'
inputs:
azureSubscription: $(azureSubscription)
appType: webAppLinux
appName: $(webAppName)
runtimeStack: 'NODE|10.10'
package: $(Pipeline.Workspace)/drop/$(Build.BuildId).zip
startUpCommand: 'npm i && npm start'
Log Message:
2021-12-22T04:32:11.764281687Z _____
2021-12-22T04:32:11.764313387Z / _ \ __________ _________ ____
2021-12-22T04:32:11.764318087Z / /_\ \___ / | \_ __ \_/ __ \
2021-12-22T04:32:11.764323187Z / | \/ /| | /| | \/\ ___/
2021-12-22T04:32:11.764326887Z \____|__ /_____ \____/ |__| \___ >
2021-12-22T04:32:11.764331087Z \/ \/ \/
2021-12-22T04:32:11.764334587Z A P P S E R V I C E O N L I N U X
2021-12-22T04:32:11.764337987Z
2021-12-22T04:32:11.764341387Z Documentation: http://aka.ms/webapp-linux
2021-12-22T04:32:11.764344787Z NodeJS quickstart: https://aka.ms/node-qs
2021-12-22T04:32:11.764348087Z NodeJS Version : v10.10.0
2021-12-22T04:32:11.764352387Z Note: Any data outside '/home' is not persisted
2021-12-22T04:32:11.764355887Z
2021-12-22T04:32:12.663348363Z Cound not find build manifest file at '/home/site/wwwroot/oryx-manifest.toml'
2021-12-22T04:32:12.663483364Z Could not find operation ID in manifest. Generating an operation id...
2021-12-22T04:32:12.663638066Z Build Operation ID: xxx
2021-12-22T04:32:13.389548261Z Environment Variables for Application Insight's IPA Codeless Configuration exists..
2021-12-22T04:32:13.645821166Z Writing output script to '/opt/startup/startup.sh'
2021-12-22T04:32:14.022579568Z Running #!/bin/sh
2021-12-22T04:32:14.023618576Z
2021-12-22T04:32:14.023642676Z # Enter the source directory to make sure the script runs where the user expects
2021-12-22T04:32:14.023649076Z cd "/home/site/wwwroot"
2021-12-22T04:32:14.031241433Z
2021-12-22T04:32:14.031263933Z export NODE_PATH=/usr/local/lib/node_modules:$NODE_PATH
2021-12-22T04:32:14.031269333Z if [ -z "$PORT" ]; then
2021-12-22T04:32:14.031276233Z export PORT=8080
2021-12-22T04:32:14.031491834Z fi
2021-12-22T04:32:14.031501034Z
2021-12-22T04:32:14.031708436Z PATH="$PATH:/home/site/wwwroot" npm i && npm start
2021-12-22T04:32:15.284402609Z npm info it worked if it ends with ok
2021-12-22T04:32:15.285412618Z npm info using npm@6.14.14
2021-12-22T04:32:15.293315385Z npm info using node@v10.10.0
2021-12-22T04:32:18.213321471Z npm info lifecycle teams-bot@1.0.0~preinstall: teams-bot@1.0.0
2021-12-22T04:32:24.493426326Z npm timing stage:loadCurrentTree Completed in 6276ms
2021-12-22T04:32:24.553827307Z npm timing stage:loadIdealTree:cloneCurrentTree Completed in 59ms
2021-12-22T04:32:26.509050286Z npm timing stage:loadIdealTree:loadShrinkwrap Completed in 1928ms
2021-12-22T04:32:28.695074538Z npm timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 2206ms
2021-12-22T04:32:29.323668363Z npm timing stage:loadIdealTree Completed in 4822ms
2021-12-22T04:32:29.929012805Z npm timing stage:generateActionsToTake Completed in 434ms
2021-12-22T04:32:30.883252384Z npm timing action:extract Completed in 376ms
2021-12-22T04:32:30.913349983Z npm timing audit submit Completed in 439ms
2021-12-22T04:32:30.924395086Z npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/audits/quick 447ms
2021-12-22T04:32:30.924415087Z npm timing audit body Completed in 9ms
2021-12-22T04:32:30.932385478Z npm timing action:finalize Completed in 42ms
2021-12-22T04:32:30.954075270Z npm timing action:refresh-package-json Completed in 21ms
2021-12-22T04:32:30.955585626Z npm timing action:preinstall Completed in 0ms
2021-12-22T04:32:30.963720723Z npm timing action:build Completed in 8ms
2021-12-22T04:32:30.964885365Z npm timing action:install Completed in 1ms
2021-12-22T04:32:30.973448978Z npm timing action:postinstall Completed in 0ms
2021-12-22T04:32:30.976428487Z npm timing stage:executeActions Completed in 527ms
2021-12-22T04:32:31.000227356Z npm timing stage:rollbackFailedOptional Completed in 24ms
2021-12-22T04:32:31.004778622Z npm info linkStuff teams-bot@1.0.0
2021-12-22T04:32:31.006571788Z npm info lifecycle teams-bot@1.0.0~install: teams-bot@1.0.0
2021-12-22T04:32:31.016047234Z npm info lifecycle teams-bot@1.0.0~postinstall: teams-bot@1.0.0
2021-12-22T04:32:31.023797317Z npm info lifecycle teams-bot@1.0.0~prepublish: teams-bot@1.0.0
2021-12-22T04:32:31.025007761Z npm info lifecycle teams-bot@1.0.0~prepare: teams-bot@1.0.0
2021-12-22T04:32:31.026173004Z npm timing stage:runTopLevelLifecycles Completed in 12913ms
2021-12-22T04:32:31.992371102Z npm info lifecycle undefined~preshrinkwrap: undefined
2021-12-22T04:32:32.588468683Z npm info lifecycle teams-bot@1.0.0~shrinkwrap: teams-bot@1.0.0
2021-12-22T04:32:32.618280873Z npm info lifecycle teams-bot@1.0.0~postshrinkwrap: teams-bot@1.0.0
2021-12-22T04:32:32.638271803Z npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
2021-12-22T04:32:32.639443546Z npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2021-12-22T04:32:32.640234375Z
2021-12-22T04:32:32.647654046Z audited 502 packages in 14.545s
2021-12-22T04:32:33.438689076Z
2021-12-22T04:32:33.438732677Z 73 packages are looking for funding
2021-12-22T04:32:33.438739877Z run `npm fund` for details
2021-12-22T04:32:33.438744777Z
2021-12-22T04:32:33.441068894Z found 0 vulnerabilities
2021-12-22T04:32:33.441087094Z
2021-12-22T04:32:33.473042036Z npm timing npm Completed in 18311ms
2021-12-22T04:32:33.474150645Z npm info ok
2021-12-22T04:32:34.485680909Z npm info it worked if it ends with ok
2021-12-22T04:32:34.486949019Z npm info using npm@6.14.14
2021-12-22T04:32:34.488340830Z npm info using node@v10.10.0
2021-12-22T04:32:34.700449238Z npm info lifecycle teams-bot@1.0.0~prestart: teams-bot@1.0.0
2021-12-22T04:32:34.713875839Z npm info lifecycle teams-bot@1.0.0~start: teams-bot@1.0.0
2021-12-22T04:32:34.719416381Z
2021-12-22T04:32:34.719447882Z > teams-bot@1.0.0 start /home/site/wwwroot
2021-12-22T04:32:34.719453882Z > ts-node ./index.ts
2021-12-22T04:32:34.719457382Z
2021-12-22T04:32:35.023004283Z internal/modules/cjs/loader.js:583
2021-12-22T04:32:35.023043883Z throw err;
2021-12-22T04:32:35.023048883Z ^
2021-12-22T04:32:35.023052783Z
2021-12-22T04:32:35.023056383Z Error: Cannot find module './util'
2021-12-22T04:32:35.023065184Z at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
2021-12-22T04:32:35.023069384Z at Function.Module._load (internal/modules/cjs/loader.js:507:25)
2021-12-22T04:32:35.023073284Z at Module.require (internal/modules/cjs/loader.js:637:17)
2021-12-22T04:32:35.023076984Z at require (internal/modules/cjs/helpers.js:20:18)
2021-12-22T04:32:35.023080584Z at Object.<anonymous> (/home/site/wwwroot/node_modules/.bin/ts-node:9:16)
2021-12-22T04:32:35.023084684Z at Module._compile (internal/modules/cjs/loader.js:689:30)
2021-12-22T04:32:35.023088484Z at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
2021-12-22T04:32:35.023092684Z at Module.load (internal/modules/cjs/loader.js:599:32)
2021-12-22T04:32:35.023096784Z at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
2021-12-22T04:32:35.023100484Z at Function.Module._load (internal/modules/cjs/loader.js:530:3)
2021-12-22T04:32:35.043138336Z npm info lifecycle teams-bot@1.0.0~start: Failed to exec start script
2021-12-22T04:32:35.053032011Z npm ERR! code ELIFECYCLE
2021-12-22T04:32:35.054289721Z npm ERR! errno 1
2021-12-22T04:32:35.064537298Z npm ERR! teams-bot@1.0.0 start: `ts-node ./index.ts`
2021-12-22T04:32:35.065160903Z npm ERR! Exit status 1
2021-12-22T04:32:35.073389065Z npm ERR!
2021-12-22T04:32:35.074245672Z npm ERR! Failed at the teams-bot@1.0.0 start script.
2021-12-22T04:32:35.074926977Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-12-22T04:32:35.103775596Z npm timing npm Completed in 747ms
2021-12-22T04:32:35.104568302Z
2021-12-22T04:32:35.105420809Z npm ERR! A complete log of this run can be found in:
2021-12-22T04:32:35.106639918Z npm ERR! /root/.npm/_logs/2021-12-22T04_32_35_075Z-debug.log
What is weird is ./util
is not even used in my project or references. Which leads me to believe