Home > OS >  Could not find required file in react app
Could not find required file in react app

Time:12-21

I have a project which is structured as follows:

- my-app
    - src
        - some files
    - public
        - index.html
    - ...

If I now execute a npm start the application runs as usual.

Now I want to rename src to application! When I run npm start now the following error message appears:

Could not find a required file.
Name: index.js
Searched in: C:\Users\{my-user}\my-app\src

Why is it now searching for an index.js and why in my-app/src?

If I now drag the public folder into application the following message appears:

Could not find a required file.
Name: index.html
Searched in: C:\Users\{my-user}\my-app\public

I know why it can't find the file, but how can I change the path at this point? Is there a setting for this in the index.html or another file?

I would be happy to receive an explanation.

CodePudding user response:

src path is hardcoded in create-react-app. You'd better keep it, but you can change it : How do I change `src` folder to something else in create-react-app

  • Related