Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/unity3d/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
azure pipeline for vue应用程序不显示网页_Azure_Vue.js_Azure Web App Service_Azure Pipelines - Fatal编程技术网

azure pipeline for vue应用程序不显示网页

azure pipeline for vue应用程序不显示网页,azure,vue.js,azure-web-app-service,azure-pipelines,Azure,Vue.js,Azure Web App Service,Azure Pipelines,我正在尝试将azure存储库中的vue应用程序部署到azure应用程序服务。我正在使用azure提供的管道。所有阶段完成,无任何问题,包括部署,无任何错误。但是当我浏览我的azure应用程序服务URL时,我得到一个应用程序错误,并且部署的Vue应用程序没有显示。这是我的pipeline.yaml文件,用于构建和部署。我做错了什么 这是错误日志 Container roiweurwoeur84934_0_46d79e91 couldn't be started: Logs = 2020-10-0

我正在尝试将azure存储库中的vue应用程序部署到azure应用程序服务。我正在使用azure提供的管道。所有阶段完成,无任何问题,包括部署,无任何错误。但是当我浏览我的azure应用程序服务URL时,我得到一个应用程序错误,并且部署的Vue应用程序没有显示。这是我的pipeline.yaml文件,用于构建和部署。我做错了什么

这是错误日志

Container roiweurwoeur84934_0_46d79e91 couldn't be started: Logs = 2020-10-08T15:53:08.292628680Z   _____                               
2020-10-08T15:53:08.292671580Z   /  _  \ __________ _________   ____  
2020-10-08T15:53:08.292677981Z  /  /_\  \___   /  |  \_  __ \_/ __ \ 
2020-10-08T15:53:08.292680981Z /    |    \/    /|  |  /|  | \/\  ___/ 
2020-10-08T15:53:08.292683881Z \____|__  /_____ \____/ |__|    \___  >
2020-10-08T15:53:08.292686981Z         \/      \/                  \/ 
2020-10-08T15:53:08.292689581Z A P P   S E R V I C E   O N   L I N U X
2020-10-08T15:53:08.292692181Z 
2020-10-08T15:53:08.292694681Z Documentation: http://aka.ms/webapp-linux
2020-10-08T15:53:08.292697081Z NodeJS quickstart: https://aka.ms/node-qs
2020-10-08T15:53:08.292699581Z NodeJS Version : v10.10.0
2020-10-08T15:53:08.292702081Z Note: Any data outside '/home' is not persisted
2020-10-08T15:53:08.292704681Z 
2020-10-08T15:53:08.333571514Z Cound not find build manifest file at '/home/site/wwwroot/oryx-manifest.toml'
2020-10-08T15:53:08.333677214Z Could not find operation ID in manifest. Generating an operation id...
2020-10-08T15:53:08.333828816Z Build Operation ID: 1e288eed-e9a6-4378-a8fb-52b980ca87d1
2020-10-08T15:53:08.947709015Z Writing output script to '/opt/startup/startup.sh'
2020-10-08T15:53:09.335664575Z Running #!/bin/sh
2020-10-08T15:53:09.335837476Z 
2020-10-08T15:53:09.335891277Z # Enter the source directory to make sure the script runs where the user expects
2020-10-08T15:53:09.335970777Z cd "/home/site/wwwroot"
2020-10-08T15:53:09.336114879Z 
2020-10-08T15:53:09.336186379Z export NODE_PATH=/usr/local/lib/node_modules:$NODE_PATH
2020-10-08T15:53:09.336240480Z if [ -z "$PORT" ]; then
2020-10-08T15:53:09.336313280Z      export PORT=8080
2020-10-08T15:53:09.336384281Z fi
2020-10-08T15:53:09.336563182Z 
2020-10-08T15:53:09.336618983Z PATH="$PATH:/home/site/wwwroot" npm run serve
2020-10-08T15:53:09.592860470Z npm info it worked if it ends with ok
2020-10-08T15:53:09.593484175Z npm info using npm@6.9.0
2020-10-08T15:53:09.593975979Z npm info using node@v10.10.0
2020-10-08T15:53:09.700042643Z npm info lifecycle vuetify-dashboard@0.1.0~preserve: vuetify-dashboard@0.1.0
2020-10-08T15:53:09.703408170Z npm info lifecycle vuetify-dashboard@0.1.0~serve: vuetify-dashboard@0.1.0
2020-10-08T15:53:09.708303910Z 
2020-10-08T15:53:09.708316710Z > vuetify-dashboard@0.1.0 serve /home/site/wwwroot
2020-10-08T15:53:09.708321010Z > vue-cli-service serve
2020-10-08T15:53:09.708324310Z 
2020-10-08T15:53:11.013684241Z internal/modules/cjs/loader.js:583
2020-10-08T15:53:11.013737842Z     throw err;
2020-10-08T15:53:11.013754342Z     ^
2020-10-08T15:53:11.013757742Z 
2020-10-08T15:53:11.013760642Z Error: Cannot find module '../package.json'
2020-10-08T15:53:11.013763542Z     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
2020-10-08T15:53:11.013766342Z     at Function.Module._load (internal/modules/cjs/loader.js:507:25)
2020-10-08T15:53:11.013769142Z     at Module.require (internal/modules/cjs/loader.js:637:17)
2020-10-08T15:53:11.013771942Z     at require (internal/modules/cjs/helpers.js:20:18)
2020-10-08T15:53:11.013774642Z     at Object. (/home/site/wwwroot/node_modules/.bin/vue-cli-service:4:25)
2020-10-08T15:53:11.013784742Z     at Module._compile (internal/modules/cjs/loader.js:689:30)
2020-10-08T15:53:11.013788642Z     at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
2020-10-08T15:53:11.013791442Z     at Module.load (internal/modules/cjs/loader.js:599:32)
2020-10-08T15:53:11.013794142Z     at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
2020-10-08T15:53:11.013796942Z     at Function.Module._load (internal/modules/cjs/loader.js:530:3)
2020-10-08T15:53:11.021617006Z npm info lifecycle vuetify-dashboard@0.1.0~serve: Failed to exec serve script
2020-10-08T15:53:11.023369320Z npm ERR! code ELIFECYCLE
2020-10-08T15:53:11.024735531Z npm ERR! errno 1
2020-10-08T15:53:11.026685147Z npm ERR! vuetify-dashboard@0.1.0 serve: `vue-cli-service serve`
2020-10-08T15:53:11.027571354Z npm ERR! Exit status 1
2020-10-08T15:53:11.028555662Z npm ERR! 
2020-10-08T15:53:11.029287868Z npm ERR! Failed at the vuetify-dashboard@0.1.0 serve script.
2020-10-08T15:53:11.030028274Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-10-08T15:53:11.034935414Z npm timing npm Completed in 1479ms
2020-10-08T15:53:11.035673120Z 
2020-10-08T15:53:11.036461427Z npm ERR! A complete log of this run can be found in:
2020-10-08T15:53:11.037147032Z npm ERR!     /root/.npm/_logs/2020-10-08T15_53_11_031Z-debug.log

您可以检查以下解决方案以将您的vue应用程序部署到azure web应用程序

运行
npm时,运行管道中的build--if-present
。生成文件将输出到文件夹
dist
。您可以直接将此
dist
文件夹打包到ArchiveFiles任务中,并部署到azure web app服务

然后您需要在AzureWebApp任务中将启动命令更改为
npx serve-s
。我更新了您的yaml管道,如下所示:

    - task: ArchiveFiles@2
      displayName: 'Archive files'
      inputs:
        rootFolderOrFile: '$(System.DefaultWorkingDirectory)/dist'  #package the dist folder
        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: roiweurwoeur84934'
            inputs:
              azureSubscription: $(azureSubscription)
              appType: webAppLinux
              appName: $(webAppName)
              runtimeStack: 'NODE|10.10'
              package: $(Pipeline.Workspace)/drop/$(Build.BuildId).zip
              startUpCommand: 'npx serve -s'

您是否有机会尝试下面的解决方案?进展如何?我尝试了另一种方法,因为它很紧急,所以没有机会尝试您的解决方案。如果有机会,我会的。感谢你的回答。你是如何解决这个问题的?你能在回答中分享你的方法吗?
    - task: ArchiveFiles@2
      displayName: 'Archive files'
      inputs:
        rootFolderOrFile: '$(System.DefaultWorkingDirectory)/dist'  #package the dist folder
        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: roiweurwoeur84934'
            inputs:
              azureSubscription: $(azureSubscription)
              appType: webAppLinux
              appName: $(webAppName)
              runtimeStack: 'NODE|10.10'
              package: $(Pipeline.Workspace)/drop/$(Build.BuildId).zip
              startUpCommand: 'npx serve -s'