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
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: "build.command" failed
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: Error location
10:52:33 PM: In Build command from Netlify app:
10:52:33 PM: npm run build
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
public directory at the root of the repository? Can you share a link to the public repository you are deploying from?
Thank you for the response here is a link
(as you have not provided the build settings you are using) the is set to the root of the repository? base directory
The issue is the front-end you are
(I assume) trying to deploy is in the directory
frontend. So setting the
to base directory
frontend will solve the issue of not finding
(which resides in the
If you are also wishing to deploy
server.js, that won’t work on Netlify as outlined in
Last reviewed by Netlify Support on December 2022
How do I run a server/database at Netlify?
We often get questions about how to run a specific backend server or database at Netlify. Examples of these types of questions include:
How to I get my node HTTP listener to respond to requests?
How do I start Mongo/MySQL/<insert-some-database-here> running on the server?
How can I SSH into my website?
We are here today to answer these questions - and the answer is: you can’t!
What do you…
Another thing to note is the hard-coded
http://localhost:4000 in several
fetch commands. That also won’t work when deployed to Netlify.
Ok thank you for the response il get that changed and I was unaware about your guidelines regarding the server.js il have a read into that shortly