简体   繁体   English

使用 Github 操作将 Next.js 部署到 Azure 应用程序服务时出现问题

[英]Problem with Deploying Next.js to Azure App Service using Github Actions

I have problem with deploying next.js to azure app service using github actions currently.我目前使用 github 操作将 next.js 部署到 azure 应用程序服务时遇到问题。 Although I am trying to deploy, I am continuously getting an error that says 'No such file or directory'虽然我正在尝试部署,但我不断收到“没有这样的文件或目录”的错误

在此处输入图像描述

The yaml file is the same as the below. yaml文件同下。

Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Build and deploy Node.js app to Azure Web App - clsreact3

on: 
  push:
    branches:
      - master 
  
env:
  AZURE_WEPAPP_NAME: clsreact3
  AZURE_WEBAPP_PACKAGE_PATH: '.'
  NODE_VERSION: '14.x'

jobs:
  build-and-deploy:
    name: Build and Deploy
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@main
    - name: Use Node.js ${{ env.NODE_VERSION }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ env.NODE_VERSION }}
    - name: npm install, build, and test
      run: |
        # Build and test the project, then
        # deploy to Azure Web App.
        npm install
        npm run build --if-present
        npm run test --if-present
      working-directory: my-app-path
    - name: 'Deploy to Azure WebApp'
      uses: azure/webapps-deploy@v2
      with: 
        app-name: ${{ env.AZURE_WEBAPP_NAME }}
        publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
        package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}

If more info is needed, please refer here.如果需要更多信息,请参阅此处。 https://github.com/scl2589/next.js-tutorial https://github.com/scl2589/next.js-教程

Thanks:)谢谢:)

So you have wrong working-directory: my-app-path and to make sure that you use correct working directory please add this step before:所以你有错误working-directory: my-app-path并确保你使用正确的工作目录请在之前添加此步骤:

 - name: List directory
      run: |
         ls .

I can't provide a better answer as I don't know your project structure.由于我不知道您的项目结构,因此无法提供更好的答案。

I am using their local git deployment method.我正在使用他们本地的 git 部署方法。 By creating a remote (named azure ) referring to the git of the azure app service (you can get it in deployment section).通过创建一个远程(名为azure )引用 azure 应用程序服务的 git(您可以在部署部分获取它)。

I complete my tasks on my repository (on master branch) then I just do this to deploy我在我的存储库(在 master 分支上)上完成我的任务然后我只是这样做来部署

git pull origin master
git push azure master

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:使用 Next.js 应用程序部署到 Azure 时出现“需要域选项” - Error: "domain option is required" when deploying to Azure with Next.js app 在 AWS Amplify 上部署 Next.js 时出错 - Error on deploying Next.js on AWS Amplify Azure Static Web 通过 GitHub 部署的应用程序 (.yml) 在私有 npm 包上出现 404 错误 - Azure Static Web App deploying via GitHub Actions (.yml) errors with 404 on private npm packages 通过 Github 操作将 node.js 部署到 azure web 应用程序,由于我引用的一些错误和下面的屏幕截图,我的构建一直失败。 请与泰 - Deploying node.js to azure web app Via Github Actions, I keep failing my build due to some error that i quoted and screenshot below. Please & Ty 使用 github 操作部署 firebase 云功能 - Deploying firebase cloud functions using github actions 如何将 next.js + mongo 应用程序部署到 AWS(或 G Cloud 等任何其他服务)? - How to deploy a next.js + mongo app to AWS (or any other service like G Cloud)? 使用 Terraform 在 Azure 应用服务环境中部署 Azure 应用服务 - Deploying Azure App Service within Azure App Service Environment using Terraform how to read environment variables in next.js (in azure app service) - how to read environment variables in next js (in azure app service) Next.js Stripe webhook 未定义函数问题 - Next.js Stripe webhook Undefined function problem 如何从github部署到Azure应用服务 - How to Deploy from github to Azure App Service
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM