Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请教一下 Deploy to GitHub Pages 这里是出了什么问题 #776

Open
shugoal opened this issue Feb 9, 2025 · 1 comment
Open

请教一下 Deploy to GitHub Pages 这里是出了什么问题 #776

shugoal opened this issue Feb 9, 2025 · 1 comment

Comments

@shugoal
Copy link

shugoal commented Feb 9, 2025

Error: Error: No uploaded artifact was found! Please check if there are any errors at build step, or uploaded artifact name is correct. at getSignedArtifactUrl (/home/runner/work/_actions/actions/deploy-pages/v1/webpack:/deploy-pages/src/api-client.js:93:1) at processTicksAndRejections (node:internal/process/task_queues:95:5) at Deployment.create (/home/runner/work/_actions/actions/deploy-pages/v1/webpack:/deploy-pages/src/deployment.js:53:1) at main (/home/runner/work/_actions/actions/deploy-pages/v1/webpack:/deploy-pages/src/index.js:30:1) Error: Error: No uploaded artifact was found! Please check if there are any errors at build step, or uploaded artifact name is correct.

deepseek说

这个错误表明 actions/deploy-pages 没有找到上传的构建产物(Artifact)。通常是因为在 actions/upload-pages-artifact 步骤中,指定的路径(path)没有正确生成或上传。

  1. 检查构建步骤
    确保在 Upload artifact 步骤之前,构建步骤(例如 pnpm build)成功运行,并且生成了正确的输出文件。

如果构建步骤失败,dist 目录可能为空或不存在,导致上传失败。

解决方法:

检查构建步骤的日志,确保没有错误。

确保构建输出路径(例如 ./dist)是正确的。

  1. 检查上传路径
    确保 actions/upload-pages-artifact 的 path 参数指向正确的目录。

如果构建输出路径不是 ./dist,需要修改 path 参数。

解决方法:

确认构建输出路径。例如,如果构建输出路径是 build,则将 path 修改为 ./build:

解决方法:

确认构建输出路径。例如,如果构建输出路径是 build,则将 path 修改为 ./build:

yaml
复制

  • name: Upload artifact
    uses: actions/upload-pages-artifact@v3
    with:
    path: './build'
  1. 检查构建输出目录是否存在
    如果构建输出目录不存在,actions/upload-pages-artifact 会失败。

解决方法:

在 Upload artifact 步骤之前,添加一个步骤来检查构建输出目录是否存在:

yaml
复制

  • name: Check build output
    run: |
    if [ ! -d "./dist" ]; then
    echo "Build output directory 'dist' does not exist!"
    exit 1
    fi
  1. 检查构建脚本
    确保构建脚本(例如 pnpm build)正确生成了输出文件。

如果构建脚本没有正确配置,可能会导致输出目录为空。

解决方法:

检查构建脚本的配置,确保它生成了正确的文件。

例如,如果你使用的是 pnpm,可以尝试在本地运行 pnpm build,检查 dist 目录是否生成。

@yihong0618
Copy link
Owner

更新到最新代码

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants