-
Notifications
You must be signed in to change notification settings - Fork 710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multiplayer tutorial crashes with node v22 and v23. Use v21 as workaround OR make a few changes and don't use -r esm
.
#1200
Comments
If you use nvm install 21
nvm use 21
...
npm run serve
npm start
|
After a few minor changes, it all works with diff --git a/package.json b/package.json
index e16e5cb..5e0e655 100644
--- a/package.json
+++ b/package.json
@@ -18,7 +18,7 @@
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
- "serve": "node -r esm src/server.js"
+ "serve": "node src/server.js"
},
"eslintConfig": {
"extends": [
diff --git a/src/Game.js b/src/Game.js
index cd503b8..d08fbd7 100644
--- a/src/Game.js
+++ b/src/Game.js
@@ -1,4 +1,4 @@
-import { INVALID_MOVE } from 'boardgame.io/core';
+import { INVALID_MOVE } from 'boardgame.io/dist/esm/core.js';
export const TicTacToe = {
name: 'tic-tac-toe',
diff --git a/src/server.js b/src/server.js
index c7276bb..3d9f0a0 100644
--- a/src/server.js
+++ b/src/server.js
@@ -1,5 +1,5 @@
-const { Server, Origins } = require('boardgame.io/server');
-const { TicTacToe } = require('./Game');
+import { Server, Origins } from 'boardgame.io/dist/cjs/server.js';
+import { TicTacToe } from './Game.js';
const server = Server({
games: [TicTacToe],
Disclaimer: I'm no a node expert so take these changes with a grain of salt. Especially, the hardcoded |
esm
.
esm
.-r esm
.
Thanks for adding me here @Henddher Your patch helped to run the server and actually I am able to run server and client now with the latest version Thank you! |
FYI
I followed the multiplayer tutorial but
npm run serve
crashes.I was able to bypass the crash by using node v21 and v20. I didn't try any older version.
The crash happens in
node
itself and only when using v23, and v22. @Thomblin posted the crash inesm
but the project was archived on Nov 4th, 2024. It will be appropriate to follow up withnode
folks and the newly assertion added a few months ago hereThe text was updated successfully, but these errors were encountered: