-1

I have created my frontend build using npm build and copied it to backend folder. Its path is "backend/build". I ran npm start in the backend directory, but nothing is showing up when I navigate to localhost:3001/ and all REST endpoints show 404.

I also get the error:

"ENOENT: no such file or directory, stat '/home/uradora/mielentilatutkimus-thl/backend/builds/thl/build/index.html'"

So it's looking for:

backend/builds/thl/build/index.html

when the actual path for the build folder is:

backend/build/index.html

How do I change the path it's looking for?

DᴀʀᴛʜVᴀᴅᴇʀ
  • 7,681
  • 17
  • 73
  • 127

1 Answers1

0

If you're using Create React App you can modify the output with BUILD_PATH:

"scripts": {
  "build": "BUILD_PATH='./backend/build' react-scripts build",
}

to start you can add the path to your script:

"scripts": {
  "start": "npm start --prefix path/to/your/app",
}
DᴀʀᴛʜVᴀᴅᴇʀ
  • 7,681
  • 17
  • 73
  • 127