odziem / nasa-project

Node.js NASA Mission Control Final Project
178 stars 360 forks source link

Unable to see client page on 8000 #4

Open DineshGuptaa opened 2 years ago

DineshGuptaa commented 2 years ago

Hi Odziem,

I have built the application on docker and cannot see the client page on the 8000 port. Please help me with how to view the client page from docker. However, I can run applications individually on my machine on ports 3000 & 8000.

Getting Error: when hitting URL:

  http://192.168.0.106:8000/
 Error: ENOENT: no such file or directory, stat '/app/server/public/index.html'

It will be great if you write a docker-compose file for the client & server.

I really appreciate any help you can provide.

JoeCrash commented 1 year ago

Edited POST:

This provides a solution for Section 9: #115. Serving React.js Front End In Production

I got the same error here, just not involving Docker. Error started when I removed the public folder from the client. (upon hearing the public/ would build inside server/)

Going directly into the client folder and running 'npm run build' gave me this error.

Could not find a required file.
  Name: index.html
  Searched in: E:\Projects\ztm-course\nasa-project\client\public

Restoring it allowed my react build to complete and get the page running again. You can restore the folder from the nasa-project-frontend.zip provided in the course resources. You can also grab it from this repo.

JoeCrash commented 1 year ago

Troubleshooting same issue, but with Docker for Windows now.

Section 16: #264. Running NASA Project in a Container

Let me start with a friendly reminder our dev environment is Windows and our container is running Linux. In #116, we need to add set BUILD_PATH to get it to work on windows.

The easiest way to resolve this problem is to replace your single build script with 2 OS specific ones. For example..

"build": "BUILD_PATH=../server/public react-scripts build",
"buildwin": "set BUILD_PATH=../server/public&& react-scripts build",

Now the container should build and start up as intended. From here, if you ever want to build locally on your Windows, use npm run buildwin

AwalHossain commented 1 year ago

Troubleshooting same issue, but with Docker for Windows now.

Section 16: #264. Running NASA Project in a Container

Let me start with a friendly reminder our dev environment is Windows and our container is running Linux. In #116, we need to add set BUILD_PATH to get it to work on windows.

The easiest way to resolve this problem is to replace your single build script with 2 OS specific ones. For example..

"build": "BUILD_PATH=../server/public react-scripts build",
"buildwin": "set BUILD_PATH=../server/public&& react-scripts build",

Now the container should build and start up as intended. From here, if you ever want to build locally on your Windows, use npm run buildwin

Thank you so much. I have been facing the same problem, and I followed two OS build paths, and it worked like a charm😊