Amplify 使“加载资源失败:服务器响应状态为 400”错误

Amplify makes `Failed to load resource: the server responded with a status of 400` error

我在使用 Amplify 时遇到了这个错误,我完成了构建。

Failed to load resource: the server responded with a status of 400
manifest.json:1 

本系统可以在本地环境下运行。 Package.json本地环境的脚本是这样的

  .......
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "format": "./node_modules/.bin/eslint --fix --ignore-path .gitignore ."
  },
  .......

下面是我的amplify.xml

version: 1
frontend:
    phases:
        preBuild:
            commands: 
                - nvm install 14.15.0
                - nvm use 14.15.0
                - yarn install
        build:
            commands: 
                - nvm install 14.15.0
                - nvm use 14.15.0
                - node -v
                - yarn run build
    artifacts:
        baseDirectory: public
        files:
            - '**/*'
    cache:
        paths:
            - 'node_modules/**/*'

屏幕完全是brank。

有没有人遇到同样的问题?

我 运行 遇到了同样的问题,在花了几个小时进行故障排除后,结果证明这是一个 Amplify CI/CD 构建配置问题。

将存储库连接到 Amplify 应用程序时,系统会提示您编辑 amplify.yaml 文件中的构建设置。无论出于何种原因,baseDirectory 的默认值设置为 public.

下载文件,将其放在存储库根目录中,然后更改:

artifacts:
  baseDirectory: public

artifacts:
  baseDirectory: build

提交、推送、重新连接 b运行ch,它应该可以工作。