在Azure Pipelines上成功建立节点无法在App Service上启动-依赖关系问题

时间:2019-04-13 12:55:42

标签: azure azure-devops continuous-integration azure-web-sites continuous-deployment

尝试将我的节点项目迁移到Azure。将源移至Azure Repos并设置Azure Pipelines CI / CD。我的源代码通过了测试,被构建并部署到App Service实例,但是在那里无法启动。


2019-04-13T11:17:11.727563855Z   /  _  \ __________ _________   ____  
2019-04-13T11:17:11.741887486Z  /  /_\  \___   /  |  \_  __ \_/ __ \ 
2019-04-13T11:17:11.741914387Z /    |    \/    /|  |  /|  | \/\  ___/ 
2019-04-13T11:17:11.741924187Z \____|__  /_____ \____/ |__|    \___  >
2019-04-13T11:17:11.741932687Z         \/      \/                  \/ 
2019-04-13T11:17:11.741953688Z A P P   S E R V I C E   O N   L I N U X
2019-04-13T11:17:11.741963888Z 
2019-04-13T11:17:11.741971688Z Documentation: http://aka.ms/webapp-linux
2019-04-13T11:17:11.741979588Z NodeJS quickstart: https://aka.ms/node-qs
2019-04-13T11:17:11.741987288Z NodeJS Version : v10.14.1
2019-04-13T11:17:11.741995089Z 
2019-04-13T11:17:12.114900305Z Generating app startup command
2019-04-13T11:17:12.139813980Z Found scripts.start in /home/site/wwwroot/package.json
2019-04-13T11:17:12.164269945Z Running npm --prefix=/home/site/wwwroot start
2019-04-13T11:17:13.701617867Z 
2019-04-13T11:17:13.701678868Z > my-app-server@1.0.0 start /home/site/wwwroot
2019-04-13T11:17:13.701692968Z > NODE_ENV=production pm2 start server.js
2019-04-13T11:17:13.701701469Z 
2019-04-13T11:17:14.489068461Z internal/modules/cjs/loader.js:582
2019-04-13T11:17:14.489134763Z     throw err;
2019-04-13T11:17:14.489144863Z     ^
2019-04-13T11:17:14.489152863Z 
2019-04-13T11:17:14.489160663Z Error: Cannot find module '../constants.js'
2019-04-13T11:17:14.489168863Z     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
2019-04-13T11:17:14.489177064Z     at Function.Module._load (internal/modules/cjs/loader.js:506:25)
2019-04-13T11:17:14.489185164Z     at Module.require (internal/modules/cjs/loader.js:636:17)
2019-04-13T11:17:14.489193164Z     at require (internal/modules/cjs/helpers.js:20:18)
2019-04-13T11:17:14.489200964Z     at Object. (/home/site/wwwroot/node_modules/.bin/pm2:11:20)
2019-04-13T11:17:14.489209464Z     at Module._compile (internal/modules/cjs/loader.js:688:30)
2019-04-13T11:17:14.489217265Z     at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
2019-04-13T11:17:14.489225365Z     at Module.load (internal/modules/cjs/loader.js:598:32)
2019-04-13T11:17:14.489233165Z     at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
2019-04-13T11:17:14.533531589Z     at Function.Module._load (internal/modules/cjs/loader.js:529:3)
2019-04-13T11:17:14.609360341Z npm ERR! code ELIFECYCLE
2019-04-13T11:17:14.651011003Z npm ERR! errno 1
2019-04-13T11:17:14.651070504Z npm ERR! may-app-server@1.0.0 start: `NODE_ENV=production pm2 start server.js`
2019-04-13T11:17:14.651096805Z npm ERR! Exit status 1
2019-04-13T11:17:14.651106405Z npm ERR! 
2019-04-13T11:17:14.651114605Z npm ERR! Failed at the my-app-server@1.0.0 start script.
2019-04-13T11:17:14.651122906Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-04-13T11:17:14.679406459Z 
2019-04-13T11:17:14.710652581Z npm ERR! A complete log of this run can be found in:
2019-04-13T11:17:14.710698082Z npm ERR!     /root/.npm/_logs/2019-04-13T11_17_14_602Z-debug.log

YAML:

trigger:
- master

pool:
  vmImage: 'Ubuntu-16.04'

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

- script: |
    npm run init
  displayName: 'install deps'

- script: |
    npm run build
  displayName: 'build frontend'

- task: ArchiveFiles@2
  displayName: 'Archive files'
  inputs:
    rootFolderOrFile: 'backend/'
    includeRootFolder: false
    verbose: true

- task: PublishBuildArtifacts@1
  displayName: 'Publish artifacts: drop'

我已经下载了工件,并尝试在本地运行它们,并且遇到相同的错误。如果我重新安装依赖项,它将运行。

我在代理上设置了'10 .14.1'和'Ubuntu-16.04',并且App Server实例具有相同的节点版本,但是linux版本不同(通用)-这可能是原因吗?

另一方面,将构建体与node_modules一起压缩并复制过来似乎有点奇怪,这是Azure方式吗?

谢谢, E。

0 个答案:

没有答案