When I type: node server/main.js, it throws an error


I’m trying to make a multiplayer tetris game in JavaScript, and this is my repository for it.

So in my project terminal, when I type: node server/main.js then I get a error which says:

      throw new ERR_SOCKET_BAD_PORT(options.port);

RangeError [ERR_SOCKET_BAD_PORT]: Port should be >= 0 and < 65536. Received 90000.
    at Server.listen (net.js:1433:13)
    at new WebSocketServer (C:\Users\eden1\Downloads\Multi Tetris\node_modules\ws\lib\websocket-server.js:74:20)
    at Object.<anonymous> (C:\Users\eden1\Downloads\Multi Tetris\server\main.js:3:16)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
    at Module.load (internal/modules/cjs/loader.js:811:32)
    at Function.Module._load (internal/modules/cjs/loader.js:723:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
    at internal/main/run_main_module.js:17:11 {

I don’t know if this has anything to do with it, but before doing this command that caused this problem, I had installed a package like this with npm: npm install ws

Help is very much appreciated,

  • C.B

It works now! What I did was, inside the server folder and in , in line 3 the port was set to 90000, to which I had put it. I tried putting 9000, and it worked!