GitHub Documentation

Quickstart fails for me



  • Hello,
    the Quickstart documentation says:
    "Create a bare-bones Colyseus server by using npm init colyseus-app.
    npm init colyseus-app my-colyseus-server
    cd my-colyseus-server
    npm start"

    I did that and got this error:

    my-app@1.0.0 start
    node src/index.js

    node:internal/modules/cjs/loader:928
    throw err;
    ^

    Error: Cannot find module 'express'
    Require stack:

    • /Users/jack/test/colyseus/my-colyseus-app/src/index.js
      at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:15)
      at Function.Module._load (node:internal/modules/cjs/loader:769:27)
      at Module.require (node:internal/modules/cjs/loader:997:19)
      at require (node:internal/modules/cjs/helpers:92:18)
      at Object.<anonymous> (/Users/jack/test/colyseus/my-colyseus-app/src/index.js:2:17)
      at Module._compile (node:internal/modules/cjs/loader:1108:14)
      at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
      at Module.load (node:internal/modules/cjs/loader:973:32)
      at Function.Module._load (node:internal/modules/cjs/loader:813:14)
      at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12) {
      code: 'MODULE_NOT_FOUND',
      requireStack: [
      '/Users/jack/test/colyseus/my-colyseus-app/src/index.js'
      ]
      }
      npm ERR! code 1
      npm ERR! path /Users/jack/test/colyseus/my-colyseus-app
      npm ERR! command failed
      npm ERR! command sh -c node src/index.js

    I then tried to install express with npm install and the package.json:
    npm ERR! code ERESOLVE
    npm ERR! ERESOLVE unable to resolve dependency tree
    npm ERR!
    npm ERR! While resolving: my-app@1.0.0
    npm ERR! Found: colyseus@0.14.6
    npm ERR! node_modules/colyseus
    npm ERR! colyseus@"^0.14.0" from the root project
    npm ERR!
    npm ERR! Could not resolve dependency:
    npm ERR! peer colyseus@"^0.11.0" from @colyseus/monitor@0.12.2
    npm ERR! node_modules/@colyseus/monitor
    npm ERR! @colyseus/monitor@"^0.12.2" from the root project
    npm ERR!
    npm ERR! Fix the upstream dependency conflict, or retry
    npm ERR! this command with --force, or --legacy-peer-deps
    npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
    npm ERR!
    npm ERR! See /Users/jack/.npm/eresolve-report.txt for a full report.

    npm ERR! A complete log of this run can be found in:
    npm ERR! /Users/jack/.npm/_logs/2021-01-06T22_14_57_858Z-debug.log

    I'm on MacOS BigSur.
    node -v: 15.4.0
    npm -v: 7.0.15
    git --version: git version 2.24.3 (Apple Git-128)

    I couldn't find anything in github issues and this forum, so I guess I made a beginner error and missed a simple step?

    Thanks for any help!



  • It was Node 15. Downgrading to Node 14 worked. On a Mac, that's
    rm -rf /usr/local/bin/node
    rm -rf /usr/local/bin/npm

    and then reinstalling Node 14.
    I created two test servers, one with typescript and one with javascript.
    For typescript, I had to run npm install first, then npm start, whereas with javascript npm start worked immediately.

    Cheers!


 

© 2021 Lucid Sight, Inc