i keep getting Could not find a required file. Name: index.html
when trying to build i have reinistalled package json and still nothing any help please
graceful-snickerdoodle-f417a8
10:52:33 PM: Could not find a required file.
10:52:33 PM: Name: index.html
10:52:33 PM: Searched in: /opt/build/repo/public
10:52:33 PM:
10:52:33 PM: "build.command" failed
10:52:33 PM: ────────────────────────────────────────────────────────────────
10:52:33 PM:
10:52:33 PM: Error message
10:52:33 PM: Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
10:52:33 PM:
10:52:33 PM: Error location
10:52:33 PM: In Build command from Netlify app:
10:52:33 PM: npm run build
10:52:33 PM:
10:52:33 PM: Resolved config
10:52:33 PM: build:
10:52:33 PM: command: npm run build
10:52:33 PM: commandOrigin: ui
10:52:33 PM: environment:
10:52:33 PM: - CI
10:52:33 PM: publish: /opt/build/repo/build
10:52:33 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
I presume (as you have not provided the build settings you are using) the base directory is set to the root of the repository?
The issue is the front-end you are (I assume) trying to deploy is in the directory frontend. So setting the base directory to frontend will solve the issue of not finding public/index.html(which resides in the frontend directory.)
If you are also wishing to deploy server.js, that won’t work on Netlify as outlined in
Another thing to note is the hard-coded http://localhost:4000 in several fetch commands. That also won’t work when deployed to Netlify.