'"Could not find a required file" on `yarn start`

I set up a create-react-app and I'm trying to run App.js on localhost, but upon doing yarn start I get the following error message:

22:23 $ yarn start
yarn run v1.3.2
$ react-scripts start
Could not find a required file.
  Name: index.html
  Searched in: /Users/-----/Desktop/---/----/hw/HW-REPO/hw-name/public
error Command failed with exit code 1.

I'd already installed yarn with yarn install, so I'm not sure if there's something wrong with my code or with the file structure.

Here's the file structure:

app-name
 -client
   --public
     ---index.html
     ---manifest.json
   --src
     ---Components
        ----various folders
     ---App.js
     ---App.test.js
     ---index.js
 -database
 -model
 -gitignore
 -package-lock.json
 -package.json
 -server.js
 -yarn.lock


Solution 1:[1]

Update: I moved yarn.lock and package.json into the client folder, did yarn install again, and then ran yarn start. Now I'm seeing good ol' error messages in the browser. I'm not 100% sure if shuffling the files around did the trick or if it was doing yarn install again, but at least it's working now.

Solution 2:[2]

In my case command npm audit fix --force change version of react-scripts in package.json As I created app with --template typescript, older version of react-scripts could not find index.js, but I have index.tsx

I solve this by removing package-lock.json, node-modules folder and remove react-scripts from package.json, then npm i react-scripts

Solution 3:[3]

In my case I opened my wrong folder in vs code and was trying to run npm start from their and npm did not find the index.html in that path, so I looked the correct path and reopened the folder and got no issue. Hope this will help some new beginner.

Solution 4:[4]

@Tsardines I was experiencing the same issue, but the 'Could not find a required file' my program was referencing was 'index.js'.

$ yarn start
# yarn run v1.13.0
# warning ..\..\..\..\package.json: No license field
$ react-scripts start
# Could not find a required file.
# Name: index.js`

This was because my index.js file was in the root folder of my project, instead of being in the 'src' folder.

I moved the file to src folder, ran 'yarn start'. Presto!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tsardines
Solution 2 Mikhail Makarov
Solution 3 V Jazz
Solution 4 KyleMit