Node Express Webpack API发布到Azure DevOps

huangapple go评论81阅读模式
英文:

Node Express Webpack API Release to Azure Dev Ops

问题

我正在尝试在Azure DevOps上使用Node.js Express发布我的项目,并在发布时部署,但当我尝试打开链接时,出现了"页面无法显示,因为发生了内部服务器错误"的错误。

YAML:
pool:
name: Azure Pipelines
steps:

  • task: NodeTool@0
    displayName: '使用 Node 14.x'
    inputs:
    versionSpec: 14.x

  • task: Npm@1
    displayName: 'npm 安装'
    inputs:
    verbose: false

  • task: Npm@1
    displayName: 'npm 自定义'
    inputs:
    command: custom
    verbose: false
    customCommand: 'run build'

  • task: PublishBuildArtifacts@1
    displayName: '发布构建工件: drop'
    inputs:
    PathtoPublish: '$(System.DefaultWorkingDirectory)'

包脚本
Node Express Webpack API发布到Azure DevOps

Webpack配置
Node Express Webpack API发布到Azure DevOps

以及Azure管道上的设置
Node Express Webpack API发布到Azure DevOps
npm安装和构建的默认设置

以及Azure发布
Node Express Webpack API发布到Azure DevOps

在构建和发布阶段都正常工作。

空白页面
Node Express Webpack API发布到Azure DevOps

我开始猜测问题可能来自Azure门户,或者它的设置方式。因为我没有创建这个门户。我只是贡献者。

请帮助澄清这一点。

我尝试构建所有文件在SCM \ wwwroot

Node Express Webpack API发布到Azure DevOps

英文:

I'm trying to release my project using Nodejs Express on Azure Dev Ops and Deploy on Release, but when I try to open the link. I'm getting a "The page cannot be displayed because an internal server error has occurred." error.

YAML:
pool:
name: Azure Pipelines
steps:

  • task: NodeTool@0
    displayName: 'Use Node 14.x'
    inputs:
    versionSpec: 14.x

  • task: Npm@1
    displayName: 'npm install'
    inputs:
    verbose: false

  • task: Npm@1
    displayName: 'npm custom'
    inputs:
    command: custom
    verbose: false
    customCommand: 'run build'

  • task: PublishBuildArtifacts@1
    displayName: 'Publish Artifact: drop'
    inputs:
    PathtoPublish: '$(System.DefaultWorkingDirectory)'

Package Script
Node Express Webpack API发布到Azure DevOps

Webpack.config
Node Express Webpack API发布到Azure DevOps

and on Azure Pipeline
Node Express Webpack API发布到Azure DevOps
the default setting of npm install and build

and on Azure Release
Node Express Webpack API发布到Azure DevOps

All are working fine, on the build and release.

Blank Page
Node Express Webpack API发布到Azure DevOps

I'm starting to guess the problem was from the azure portal, or on the way it was setup. Because I didn't create the portal. I'm only the Contributor.

Please help clarify this.

I try to build all files on SCM \wwwroot

Node Express Webpack API发布到Azure DevOps

答案1

得分: 0

  • 确保 index.js 文件已部署到您的 Azure 应用服务中。

  • 由于您的现有应用程序存在一些问题,请使用此 MS-DOC 创建新的应用程序。

  • 登录到 Azure Pipelines。您的浏览器将转到显示您的 Azure DevOps 仪表板。

  • 在项目的管道菜单下创建新的管道。

  • 选择 GitHub 作为源代码位置。

  • 如果代码放在 GitHub 中,请使用 Git 凭据登录。

  • 当仓库列表显示时,选择您的示例 Node.js 仓库。

  • Azure Pipelines 分析您的仓库中的代码并自动为您的管道提供一个 Node.js 模板。选择此模板。

  • Azure Pipelines 将自动生成一个 YAML 文件在您的管道中。点击保存并运行 > 直接提交到主分支,然后再次选择保存和运行。

一个新的运行开始了。等待运行完成。

英文:
  • Make sure the index.js file is deployed to your azure app service

  • As you have some issues with your existing application Create the new application using this MS-DOC

  • Sign into Azure Pipelines. Your browser will go to to display your Azure DevOps dashboard.

  • Create New pipeline under the pipeline's menu of your project

  • Select GitHub as the source code location.

  • If the code is placed in GitHub, then login with Git Creds

  • When the list of repositories appears, select your sample Node.js repository.

  • Azure Pipelines analyzes the code in your repository and automatically gives a Node.js template for your pipeline. Select this template.

  • Azure Pipelines will automatically generates a YAML file in your pipeline. Click on Save and Run > Commit Directly to Master Branch and then choose Save ad Run again.

A new run begins. Wait for the run to complete.

huangapple
  • 本文由 发表于 2023年1月6日 17:31:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/75029134.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定