【问题标题】:Vue.js does not start in Azure App ServiceVue.js 未在 Azure 应用服务中启动
【发布时间】:2021-04-21 09:06:48
【问题描述】:

我目前在 Azure Dev Ops 中有一个管道,用于构建、复制、存档,然后将 Vue.js 应用部署到在 Linux 上运行的 Azure 应用服务。当我通过 SSH 连接到服务器时,我确实看到构建的输出成功地出现在 wwwroot 文件夹中,但是当我拉起应用服务的 URL 时,我只看到了默认登录页面。下面是我的 wwwroot 文件夹的屏幕截图,当我提取 URL 时看到的页面和管道的 yml 文件的副本。 yml 文件中是否还缺少其他东西,我需要添加以告诉应用服务偶然启动 vue.js 应用,我对这些东西还很陌生。

# Build a Node.js project that uses Vue.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

trigger:
- master

pool:
  vmImage: ubuntu-latest

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

- script: |
    npm install
    npm run build
  displayName: 'npm install and build'
  workingDirectory: $(Build.SourcesDirectory)/client-app

- task: CopyFiles@2
  inputs:
    Contents: '$(Build.SourcesDirectory)/client-app/dist/**'
    TargetFolder: '$(Build.ArtifactStagingDirectory)'
    flattenFolders: true

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

- task: AzureRmWebAppDeployment@4
  inputs:
    ConnectionType: 'AzureRM'
    azureSubscription: 'Azure subscription 1 (f719f76c-c23e-4160-aa93-914eb7851fdb)'
    appType: 'webAppLinux'
    WebAppName: 'trashbot'
    packageForLinux: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'

【问题讨论】:

  • 如果我的回复有帮助,请采纳为答案(点击回复旁边的标记选项将其从灰色切换为填写。),请参阅meta.stackexchange.com/questions/5234/…
  • @JasonPan 是的,成功了,谢谢。

标签: node.js azure vue.js azure-devops azure-web-app-service


【解决方案1】:

您需要在门户上添加startup command

pm2 serve /home/site/wwwroot --no-daemon --spa

相关文章:

1. Application is not loading when deployed via azure app service

2. Default Documents (custom 404) on Azure AppService Linux website

【讨论】:

    猜你喜欢
    • 2019-10-30
    • 2020-05-03
    • 2014-07-30
    • 2021-09-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多