ReactJS - net::ERR_FILE_NOT_FOUND
You need to add "homepage": "./"
to your package.json.
From:https://github.com/facebook/create-react-app/issues/6275#issuecomment-457813277
- Open your package.json file.
- Add this entry to it
"homepage":"path\to\your\project\build\"
- Re-run the command
npm run build
.
The issue here was when you run the npm run build command without the homepage entry added in your package.json,it is built assuming that the project directory (where you are running the command) is hosted at server root.
D:\git_repo\my-app>npm run build> my-app@0.1.0 build D:\git_repo\my-app> react-scripts buildCreating an optimized production build...Compiled successfully.File sizes after gzip: 44.57 KB build\static\js\main.8a29685f.js**The project was built assuming it is hosted at root directory.You can control this with the homepage field in your package.json.**The build folder is ready to be deployed.D:\git_repo\my-app>
How are you running your app? Are you just opening the index.html in the browser or are you using serve -s build
and such?
If you are doing it by the first option then you should consider trying serve -s build