reactjs - 为什么我在 "Cannot find file ' 中收到此错误 : './src' ./App'。":?

标签 reactjs amazon-web-services create-react-app aws-amplify

我正在尝试将我的 React 应用程序部署到 aws-amplify,但我在 aws 的构建过程中不断收到此错误。

当我在生产环境中运行应用程序时,“yarn run build”它在本地运行良好,但是当我将更改推送到 aws 时,出现以下错误:

"Failed to compile.
2020-07-26T15:51:52.356Z [INFO]: ./src/index.js
Cannot find file './App' in './src'.":

more detailed aws error image attached

我的文件夹结构如下:

- public
  - favicon.ico
  - index.html
  - logo192.png
  - logo512.png
  - manifest.json
  - robots.txt
- src
  - assets
  - components
    - Contact.js
    - Home.js
    - Navigation.js
    - NotFound.js
    - Project.js
    - Projects.js
  - App.css
  - App.js
  - App.test.js
  - contact.css
  - home.css
  - index.css
  - index.js
  - logo.svg
  - projects.css
  - serviceWorker.js
  - setupTest.js
- .gitignore
- package.json
- README.md
- yarn.lock

app component

screenshot of my index.js and the folder structure

最佳答案

您包含文件 App.css 但只有 app.css。修正第一个字母的大小写。

一些操作系统(或者更确切地说,一些文件系统)是区分大小写的。您必须正确填写文件名。

如果您使用的是版本控制系统(例如 git),请确保您已在版本控制系统中重命名该文件。在不区分大小写的文件系统上,不会检测到大小写更改。

关于reactjs - 为什么我在 "Cannot find file ' 中收到此错误 : './src' ./App'。":?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63102949/

相关文章:

javascript - Reactjs Axios 不会捕获

reactjs - react如何在不同组件中使用axios实例?

javascript - 类型错误 : middleware is not a function in store

amazon-web-services - 如何在 `~/.aws/config` 中生成 AWS 配置文件以用于 CodeBuild 项目

c++ - AWS 开发工具包 C++ 签名 V2

css - 为什么 create-react-app 找不到我的 Sass 变量

javascript - 在 Sharepoint 上 react 'Set is undefined'

java - Lambda 函数输出为对象

create-react-app - 解析错误 : '=' expected in `import type`

javascript - Create-React-App 创建这个 <iframe> 阻止我直接单击或编辑应用程序,除非我在元素浏览器编辑器中将其删除