【问题标题】:Can't deploy MEAN stack app to Azure App Service via pipeline无法通过管道将 MEAN 堆栈应用程序部署到 Azure 应用程序服务
【发布时间】:2020-02-21 10:57:41
【问题描述】:

我无法将我的应用部署到 Azure 应用服务。我创建了一个在 azure 应用服务部署阶段失败的管道。我一直在努力让这个工作好几天了。我终于通过了部署应用程序阶段,但是当我单击 URL 时它只是说应用程序错误?我将其配置为指向正确的订阅。 Web App for Linux,然后选择了 app-service 调用 gc-dev,但我仍然得到错误。尝试从 vscode 部署应用程序时,我也遇到相同的应用程序错误。两种部署类型都可能处理完全相同的问题。不过 IDK。

我觉得它与启动命令有关,因为没有调用 ng serve 来启动角度代码,但我不确定。可能与该问题相关的另一件事是,我所有的 Angular 服务仍然有 http://localhost:3000/api/ 而不是一些云 url。不确定这是否是初始页面加载的问题。我觉得它至少应该仍然加载登录屏幕。感谢您的帮助!

部署阶段

步骤如下:

steps:
- task: Npm@1
  displayName: 'install the @anguliar/cli'
  inputs:
    command: custom
    workingDir: glass/
    verbose: false
    customCommand: 'install @angular/cli -g'


steps:
- task: Npm@1
  displayName: 'install the project'
  inputs:
    workingDir: glass/
    verbose: false

steps:
- task: Npm@1
  displayName: 'build project'
  inputs:
    command: custom
    workingDir: my-app/
    verbose: false
    customCommand: 'run build'

steps:
- task: Npm@1
  displayName: 'npm install the dist/folder for express'
  inputs:
    workingDir: my-app/dist/
    verbose: false
steps:
- task: Npm@1
  displayName: 'Build the project'
  inputs:
    command: custom
    workingDir: my-app
    verbose: false
    customCommand: 'run build'


steps:
- task: AzureRmWebAppDeployment@4
  displayName: 'Azure App Service Deploy: my-app dev'
  inputs:
    azureSubscription: 'Azure subscription 1 (99c421dc-5cf5-444c-8df5-c71[![enter image description here][2]][2]02)'
    appType: webAppLinux
    WebAppName: 'gc-dev'
    packageForLinux: my-app
    WebConfigParameters: '-Handler iisnode -NodeStartFile index.js -appType node'
    enableCustomDeployment: true
    TakeAppOfflineFlag: false


【问题讨论】:

  • 您在哪里托管 Anguler 前端?
  • 也许这就是我感到困惑的地方。我要单独部署它们吗?我认为它会同时手动部署两者。如果是这种情况,我也单独尝试过。我将它指向 dist\\main 并且它甚至不会显示主 html 页面。它至少应该这样做。我知道如果没有后端我将无法登录,但我应该会看到一些我认为的东西
  • 我看了教程,但它只涵盖了角度。我也需要使用我的 express/nodejs 服务器进行部署的帮助。我也更新了我的问题。
  • npm installstep 看起来不正确...您确定所有步骤都通过...您是否有来自 azure 门户的错误日志

标签: node.js angular linux azure azure-web-app-service


【解决方案1】:

嗯,一方面,这不可能是正确的:

WebAppName: 'My-app - Dev' 

应用服务应用名称中不能有空格。它是默认 URL 的一部分。

【讨论】:

  • 我创建了一个名为gc-dev 的新应用服务,请参阅图片以供参考。当我运行管道时,我现在走得更远了,但是我在 Azure App Service Deploy 任务上遇到了一个不同的错误,上面写着 ng build An unhandled exception occurred: ENOENT: no such file or directory, open '/tmp/glass/node_modules/bootstrap/dist/js/bootstrap.min.js' 不知道为什么,但它确实通过了其他构建项目任务。在失败之前完成该任务需要大约 7 分钟。更新的应用服务名称:postimg.cc/5jr1h3rB 应用服务:postimg.cc/3466cLwW
猜你喜欢
  • 2017-09-05
  • 2019-11-24
  • 2018-11-08
  • 2017-03-09
  • 2020-01-19
  • 2023-03-27
  • 2014-03-09
  • 1970-01-01
  • 2020-09-30
相关资源
最近更新 更多