jsfiddle / togetherjs

A service for your website that makes it surprisingly easy to collaborate in real-time.
https://togetherjs.com
Mozilla Public License 2.0
7.01k stars 849 forks source link

BUG? Error: Cannot find module 'websocket-server' #1112

Closed shamun closed 7 years ago

shamun commented 7 years ago

I am getting this error:

# node hub/server.js -h

module.js:340
    throw err;
          ^
Error: Cannot find module 'websocket-server'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/var/www/html/sip-phone/tls/togetherjs-develop/hub/websocket-compat.js:27:28)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)

Even though i have done:

$ npm install websocket optimist
npm http 200 https://registry.npmjs.org/nan
npm http GET https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz
npm http GET https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.2.tgz
npm http GET https://registry.npmjs.org/debug/-/debug-2.6.0.tgz
npm http 200 https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.2.tgz
npm http 200 https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz
npm http GET https://registry.npmjs.org/nan/-/nan-2.5.1.tgz
npm http 200 https://registry.npmjs.org/debug/-/debug-2.6.0.tgz
npm http 200 https://registry.npmjs.org/nan/-/nan-2.5.1.tgz
npm http GET https://registry.npmjs.org/is-typedarray
npm http 200 https://registry.npmjs.org/is-typedarray
npm http GET https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz
npm http 200 https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz
npm http GET https://registry.npmjs.org/ms/0.7.2
npm http 200 https://registry.npmjs.org/ms/0.7.2
npm http GET https://registry.npmjs.org/ms/-/ms-0.7.2.tgz
npm http 200 https://registry.npmjs.org/ms/-/ms-0.7.2.tgz

> websocket@1.0.24 install /var/www/html/sip-phone/tls/togetherjs-develop/node_modules/websocket
> (node-gyp rebuild 2> builderror.log) || (exit 0)

make: Entering directory `/var/www/html/sip-phone/tls/togetherjs-develop/node_modules/websocket/build'
  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
make: Leaving directory `/var/www/html/sip-phone/tls/togetherjs-develop/node_modules/websocket/build'
optimist@0.6.1 ../node_modules/optimist
├── wordwrap@0.0.3
└── minimist@0.0.10

websocket@1.0.24 ../node_modules/websocket
├── yaeti@0.0.6
├── typedarray-to-buffer@3.1.2 (is-typedarray@1.0.0)
├── nan@2.5.1
└── debug@2.6.0 (ms@0.7.2)

$ node
> require("websocket")
{ server: 
   { [Function: WebSocketServer]
     super_: { [Function: EventEmitter] listenerCount: [Function] } },
  client: 
   { [Function: WebSocketClient]
     super_: { [Function: EventEmitter] listenerCount: [Function] } },
  router: 
   { [Function: WebSocketRouter]
     super_: { [Function: EventEmitter] listenerCount: [Function] } },
  frame: [Function: WebSocketFrame],
  request: 
   { [Function: WebSocketRequest]
     super_: { [Function: EventEmitter] listenerCount: [Function] } },
  connection: 
   { [Function: WebSocketConnection]
     CLOSE_REASON_NORMAL: 1000,
     CLOSE_REASON_GOING_AWAY: 1001,
     CLOSE_REASON_PROTOCOL_ERROR: 1002,
     CLOSE_REASON_UNPROCESSABLE_INPUT: 1003,
     CLOSE_REASON_RESERVED: 1004,
     CLOSE_REASON_NOT_PROVIDED: 1005,
     CLOSE_REASON_ABNORMAL: 1006,
     CLOSE_REASON_INVALID_DATA: 1007,
     CLOSE_REASON_POLICY_VIOLATION: 1008,
     CLOSE_REASON_MESSAGE_TOO_BIG: 1009,
     CLOSE_REASON_EXTENSION_REQUIRED: 1010,
     CLOSE_REASON_INTERNAL_SERVER_ERROR: 1011,
     CLOSE_REASON_TLS_HANDSHAKE_FAILED: 1015,
     CLOSE_DESCRIPTIONS: 
      { '1000': 'Normal connection closure',
        '1001': 'Remote peer is going away',
        '1002': 'Protocol error',
        '1003': 'Unprocessable input',
        '1004': 'Reserved',
        '1005': 'Reason not provided',
        '1006': 'Abnormal closure, no further detail available',
        '1007': 'Invalid data received',
        '1008': 'Policy violation',
        '1009': 'Message too big',
        '1010': 'Extension requested by client is required',
        '1011': 'Internal Server Error',
        '1015': 'TLS Handshake Failed' },
     super_: { [Function: EventEmitter] listenerCount: [Function] } },
  w3cwebsocket: [Function: W3CWebSocket],
  deprecation: 
   { disableWarnings: false,
     deprecationWarningMap: {},
     warn: [Function] },
  version: '1.0.24' }