使用 Flutter Web 部署到 GitHub Pages 不起作用

问题描述 投票:0回答:1

使用 Flutter Web 操作部署到 GitHub Pages 不起作用。

我总是收到空白页。

任何帮助表示赞赏。

我正在 GitHub Actions 上使用以下管道

name: Deploy to GitHub Pages

on:
  push:
    branches:
      - master

permissions:
  contents: read
  pages: write
  id-token: write

# Deploy to the github-pages environment


jobs:  
  build-and-deploy:
    runs-on: ubuntu-latest
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    steps:
      - uses: actions/checkout@v3
      - name: Set up Flutter
        uses: subosito/flutter-action@v2
        with:
          channel: stable
      - name: Install dependencies
        run: flutter pub get
        working-directory: ${{env.working-directory}}
      - name: Build web app
        run: flutter build web
        working-directory: ${{env.working-directory}}

      - name: Upload Pages artifact
        uses: actions/upload-pages-artifact@v2
        with:
          path: build/web/

      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v2
flutter github-pages
1个回答
0
投票

已修复。

我的解决方案是在 insertprojectname/web/index.html

中注释掉以下代码行

将其推送到 GitHub 后 - 构建开始工作。希望这对其他被困的人有用。祝你好运,起亚卡哈。

© www.soinside.com 2019 - 2024. All rights reserved.