部署到 Netlify 时找不到所需的文件 index.html
Could not find a required file, index.html while deploying to Netlify
public 文件夹在正确的位置,是的,我已经跟踪了所有带有 Git 的文件,index.html
可用并且在正确的位置,这就是为什么没有出现此错误的原因对我来说似乎很有意义。
$ yarn build
8:08:03 PM: yarn run v1.22.4
8:08:03 PM: $ react-scripts build
8:08:04 PM: Could not find a required file.
8:08:04 PM: Name: index.html
8:08:04 PM: Searched in: /opt/build/repo/public
8:08:04 PM: error Command failed with exit code 1.
8:08:04 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
8:08:04 PM:
8:08:04 PM: ┌─────────────────────────────┐
8:08:04 PM: │ "build.command" failed │
8:08:04 PM: └─────────────────────────────┘
8:08:04 PM:
8:08:04 PM: Error message
8:08:04 PM: Command failed with exit code 1: yarn build
8:08:04 PM:
8:08:04 PM: Error location
8:08:04 PM: In Build comma
不幸的是,我犯了一个非常令人沮丧的错误,我正在从 Gatsby 进行改造,Gatsby .gitignore
列出了 public
目录,我忘了删除 [=10] 中的 public
=] 文件,所以 public
目录没有被推送到 GitHub.
public 文件夹在正确的位置,是的,我已经跟踪了所有带有 Git 的文件,index.html
可用并且在正确的位置,这就是为什么没有出现此错误的原因对我来说似乎很有意义。
$ yarn build
8:08:03 PM: yarn run v1.22.4
8:08:03 PM: $ react-scripts build
8:08:04 PM: Could not find a required file.
8:08:04 PM: Name: index.html
8:08:04 PM: Searched in: /opt/build/repo/public
8:08:04 PM: error Command failed with exit code 1.
8:08:04 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
8:08:04 PM:
8:08:04 PM: ┌─────────────────────────────┐
8:08:04 PM: │ "build.command" failed │
8:08:04 PM: └─────────────────────────────┘
8:08:04 PM:
8:08:04 PM: Error message
8:08:04 PM: Command failed with exit code 1: yarn build
8:08:04 PM:
8:08:04 PM: Error location
8:08:04 PM: In Build comma
不幸的是,我犯了一个非常令人沮丧的错误,我正在从 Gatsby 进行改造,Gatsby .gitignore
列出了 public
目录,我忘了删除 [=10] 中的 public
=] 文件,所以 public
目录没有被推送到 GitHub.