lazarv / react-server

The easiest way to build React apps with server-side rendering
https://react-server.dev
MIT License
121 stars 6 forks source link

Feedback and errors while following hello-world tutorial #9

Closed lionelhorn closed 4 months ago

lionelhorn commented 4 months ago

Hello,

I recently discovered your package and started testing on a windows machine.

Following the step of https://react-server.dev/tutorials/hello-world

Issues with Node 20.8.1

> pnpm exec react-server ./App.jsx

node:internal/errors:497
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_IMPORT_ASSERTION_TYPE_MISSING]: Module "file:///C:/PROG/_experiments/_tmp/my-first-application/node_modules/.pnpm/@lazarv+react-server@0.0.0-experimental-1ebed9f-20240709-604f6b67_@types+node@20.14.10_react-_6c2sbkclap3cav5wojpnsvlz5i/node_modules/@lazarv/react-server/package.json" needs an import assertion of type "json"
    at new NodeError (node:internal/errors:406:5)
    at validateAssertions (node:internal/modules/esm/assert:94:15)
    at defaultLoad (node:internal/modules/esm/load:122:3)
    at ModuleLoader.load (node:internal/modules/esm/loader:396:13)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:278:56)
    at new ModuleJob (node:internal/modules/esm/module_job:65:26)
    at #createModuleJob (node:internal/modules/esm/loader:290:17)
    at ModuleLoader.getJobFromResolveResult (node:internal/modules/esm/loader:248:34)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:229:17)
    at async ModuleLoader.import (node:internal/modules/esm/loader:315:23) {
  code: 'ERR_IMPORT_ASSERTION_TYPE_MISSING'
}

While looking at https://github.com/lazarv/react-server/blob/e4b7fdfaa431c90fb31f4a3d1c633c9405beee13/packages/react-server/package.json#L111 I assumed 20.8.1 would we fine.

Node 22.4.0

> my-first-application@1.0.0 start C:\PROG\_experiments\_tmp\my-first-application
> pnpm exec react-server ./App.jsx
dep-DXWVQosX.js:1336912:08:25 [react-server] listening on http://127.0.0.1:3000
dep-DXWVQosX.js:1336912:08:25 [react-server] ✔ Ready in 720ms

Connection refused at http://127.0.0.1:3000 But it works on localhost:3000 Not sure what's going on there.

lionelhorn commented 4 months ago
image

Clicking on a link from the menu results in a blank page.

lazarv commented 4 months ago

I assumed 20.8.1 would we fine.

I will update the minimum node.js version required, it should be 20.10 since https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V20.md#other-notable-changes-3

Connection refused at http://127.0.0.1:3000/ But it works on localhost:3000 Not sure what's going on there.

The default hostname is localhost, but the log is reporting the actual IP address where the server is listening on. I would prefer to fix the log message and use the provided or default hostname if it's configured.

You can use pnpm exec react-server ./App.jsx --host to listen on all available local hostnames.

Clicking on a link from the menu results in a blank page.

This will get fixed soon, sorry for the bad experience.

lazarv commented 4 months ago

All of the issues reported here now should work with the latest version of @lazarv/react-server. Thanks again for catching and reporting all of these @lionelhorn!

lionelhorn commented 4 months ago

You're welcome. Thanks for the quick fix :)

github-actions[bot] commented 2 months ago

This issue has been locked since it has been closed for more than 30 days.

If you have found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest version of @lazarv/react-server. If you have any other comments you should create a new discussion.