I have faced the same problem after deploying it to Firebase. It seems to be an error for the CRA development server when adding the homepage line in package.json. I received a lot of errors in the console, this one and some including %PUBLIC_URL% fails from index.html. So, I fixed this by removing "homepage": "https://github.com/yourname/yourrepo" from package.json.

In your folder2 you had written

app.get('/*', function(req, res) {
    res.sendFile(path.join(__dirname, 'build', 'index.html'));
});

But are if you are not using this then it is going to show the error which you are getting

app.use(express.static(path.join(__dirname, "build")));

Just use the above and you are good to go.

But in my case when i use the above then the page is loaded but get request to / is not loaded from app.get('/') instead that page is loaded through the line which we just added above, and here I want that page loaded from app.get('/') as i was sending some cookies, so for that I replace above line with following:

app.use('/static', express.static(path.join(__dirname, "build/static")));
app.use('/manifest.json', express.static(path.join(__dirname, "build", "manifest.json")));

 same issue I solve it by:

  1. Go into package.json file in your react app.

  2. You will see the homepage attribute at the top, remove it either copy that URL.

  • If you remove it then again create build and use that build in your express.static('./build').

  • If you copy it then use that url in your app.use("that copied url" , express.static('./build')) in your express server file.

 I had this added in my manifest.json:

"storage": {
   "managed_schema": "storage.json"
}

But my storage.json was empty. I had to edit my storage.json file with this content:

{
   "$schema": "http://json-schema.org/draft-03/schema#",
   "type": "object",
   "properties": {
      "adminSettings": {
         "title": "A valid JSON string compliant with backup format.",
         "description": "All entries present will overwrite local settings.",
         "type": "string"
      }
   }
}

The browser cannot find the manifest because the extension (MIME type). In Chrome DevTools > Network > Headers > Content-Type, the content-type of the manifest must match the actual manifest file extension (.json or .webmanifest). To resolve the 404 error, you need to declare the file type in web.config:

<staticContent>
  <mimeMap fileExtension=".json" mimeType="application/json" />
  <mimeMap fileExtension=".webmanifest" mimeType="application/manifest+json" />
</staticContent>