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
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With