Thorium-Sim / thorium-nova

Next-generation Spaceship Controls
https://thoriumsim.com
Apache License 2.0
345 stars 14 forks source link

Root npm run dev only runs server and never started the client #574

Closed shurik closed 1 year ago

shurik commented 1 year ago

Describe the bug

Following the README running npm run dev only starts the server not the client.

To Reproduce Steps to reproduce the behavior:

I cloned the repo and followed the readme and started the server. Didn’t see next steps after that in the readme. Readme tells you to open local host 3000 and cli output from npm run dev shows 3001 and 3002. Opening 3001 shows 500. I mean server error 500. At that point I searched GitHub for similar issues and didn't find them.

Expected behavior

Expect to see both client and server start with the client opening the user's default browser and showing the welcome screen.

Screenshots

N/A

Additional context

N/A

shurik commented 1 year ago

If you dig in to the package.json file and run the commands manually you see that the server starts on the IP of the machine and the npx wait-on is checking localhost. So wait reports server down and never starts the client.

❯ npm run dev

> thorium-nova@1.0.0-alpha.9 dev
> node -r ts-eager/register scripts/dev.ts

[server] 
[server] > server@1.0.1 dev
[server] > nodemon
[server] 
[server] [nodemon] 2.0.20
[server] [nodemon] to restart at any time, enter `rs`
[server] [nodemon] watching path(s): src/**/* ../shared/** ../client/src/**/data.ts ../client/src/**/data.tsx ../client/src/**/data/**/*.ts ../client/src/**/data/**/*.tsx
[server] [nodemon] watching extensions: ts,tsx,mjs,js,json
[server] [nodemon] starting `node -r ts-eager/register --trace-warnings src/index.ts`
[server] Access app at http://100.111.17.113:3001
[server] Doing port forwarding? Open this port in your router:
[server]   - TCP 3001 for web app access
[server]   - TCP 3002 for HTTPS access
❯ npx wait-on -v http://localhost:3001/healthcheck
waiting for 1 resources: http://localhost:3001/healthcheck
making HTTP(S) head request to  url:http://localhost:3001/healthcheck ...
  HTTP(S) error for http://localhost:3001/healthcheck Error: connect ECONNREFUSED ::1:3001
making HTTP(S) head request to  url:http://localhost:3001/healthcheck ...
  HTTP(S) error for http://localhost:3001/healthcheck Error: connect ECONNREFUSED ::1:3001
making HTTP(S) head request to  url:http://localhost:3001/healthcheck ...
  HTTP(S) error for http://localhost:3001/healthcheck Error: connect ECONNREFUSED ::1:3001
making HTTP(S) head request to  url:http://localhost:3001/healthcheck ...
  HTTP(S) error for http://localhost:3001/healthcheck Error: connect ECONNREFUSED ::1:3001
making HTTP(S) head request to  url:http://localhost:3001/healthcheck ...
  HTTP(S) error for http://localhost:3001/healthcheck Error: connect ECONNREFUSED ::1:3001
making HTTP(S) head request to  url:http://localhost:3001/healthcheck ...
  HTTP(S) error for http://localhost:3001/healthcheck Error: connect ECONNREFUSED ::1:3001
making HTTP(S) head request to  url:http://localhost:3001/healthcheck ...
  HTTP(S) error for http://localhost:3001/healthcheck Error: connect ECONNREFUSED ::1:3001
making HTTP(S) head request to  url:http://localhost:3001/healthcheck ...
  HTTP(S) error for http://localhost:3001/healthcheck Error: connect ECONNREFUSED ::1:3001
making HTTP(S) head request to  url:http://localhost:3001/healthcheck ...
  HTTP(S) error for http://localhost:3001/healthcheck Error: connect ECONNREFUSED ::1:3001
making HTTP(S) head request to  url:http://localhost:3001/healthcheck ...
  HTTP(S) error for http://localhost:3001/healthcheck Error: connect ECONNREFUSED ::1:3001
making HTTP(S) head request to  url:http://localhost:3001/healthcheck ...
  HTTP(S) error for http://localhost:3001/healthcheck Error: connect ECONNREFUSED ::1:3001
making HTTP(S) head request to  url:http://localhost:3001/healthcheck ...
  HTTP(S) error for http://localhost:3001/healthcheck Error: connect ECONNREFUSED ::1:3001
making HTTP(S) head request to  url:http://localhost:3001/healthcheck ...
  HTTP(S) error for http://localhost:3001/healthcheck Error: connect ECONNREFUSED ::1:3001

A potential solution is to have the wait on command match the IP the server is on or vice versa.

alexanderson1993 commented 1 year ago

Ah, the cursed change to IPv6 default in Node 18. This shouldn't be too difficult to address.

alexanderson1993 commented 1 year ago

Just pushed the fix for this to develop