OpenSOC / opensoc-ui

User interface for OpenSOC
Apache License 2.0
100 stars 55 forks source link

Test Failure - Cannot read property 'prototype' of undefined #20

Open nickwallen opened 9 years ago

nickwallen commented 9 years ago

I am following the "Development" instructions. I am able to launch the Ubuntu image through Vagrant, but the tests fail when I attempt to run them. I see a similar error when I attempt to launch the server.

Test Failure

vagrant@vagrant-ubuntu-trusty-64:/vagrant$ npm test

> opensoc-ui@0.0.14 test /vagrant
> NODE_ENV=TEST ./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- --check-leaks -R spec

=============================================================================
Writing coverage object [/vagrant/coverage/coverage.json]
Writing coverage reports at [/vagrant/coverage]
=============================================================================

=============================== Coverage summary ===============================
Statements   : 20.62% ( 40/194 )
Branches     : 5.17% ( 3/58 )
Functions    : 4.76% ( 1/21 )
Lines        : 20.62% ( 40/194 )
================================================================================

util.js:555
  ctor.prototype = Object.create(superCtor.prototype, {
                                          ^
TypeError: Cannot read property 'prototype' of undefined
    at Object.exports.inherits (util.js:555:43)
    at Object.<anonymous> (/vagrant/node_modules/http-proxy/lib/http-proxy/index.js:108:17)
    at Module._compile (module.js:456:26)
    at Module._extensions..js (module.js:474:10)
    at Object.Module._extensions..js (/vagrant/node_modules/istanbul/lib/hook.js:101:13)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/vagrant/node_modules/http-proxy/lib/http-proxy.js:4:17)
    at Module._compile (module.js:456:26)
    at Module._extensions..js (module.js:474:10)
    at Object.Module._extensions..js (/vagrant/node_modules/istanbul/lib/hook.js:101:13)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/vagrant/node_modules/http-proxy/index.js:13:18)
    at Module._compile (module.js:456:26)
    at Module._extensions..js (module.js:474:10)
    at Object.Module._extensions..js (/vagrant/node_modules/istanbul/lib/hook.js:101:13)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at module.exports (/vagrant/lib/modules/es-proxy.js:9:169)
    at Object.<anonymous> (/vagrant/lib/opensoc-ui.js:9:1947)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (/vagrant/node_modules/istanbul/lib/hook.js:99:20)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/vagrant/test/opensoc-ui-test.js:5:10)
    at Module._compile (module.js:456:26)
    at Module._extensions..js (module.js:474:10)
    at Object.Module._extensions..js (/vagrant/node_modules/istanbul/lib/hook.js:101:13)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at /vagrant/node_modules/mocha/lib/mocha.js:184:27
    at Array.forEach (native)
    at Mocha.loadFiles (/vagrant/node_modules/mocha/lib/mocha.js:181:14)
    at Mocha.run (/vagrant/node_modules/mocha/lib/mocha.js:393:31)
    at Object.<anonymous> (/vagrant/node_modules/mocha/bin/_mocha:380:16)
    at Module._compile (module.js:456:26)
    at Module._extensions..js (module.js:474:10)
    at Object.Module._extensions..js (/vagrant/node_modules/istanbul/lib/hook.js:101:13)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at runFn (/vagrant/node_modules/istanbul/lib/command/common/run-with-cover.js:116:16)
    at /vagrant/node_modules/istanbul/lib/command/common/run-with-cover.js:240:17
    at /vagrant/node_modules/istanbul/lib/util/file-matcher.js:56:16
    at /vagrant/node_modules/istanbul/lib/util/file-matcher.js:35:9
    at Object.next (/vagrant/node_modules/istanbul/node_modules/fileset/lib/fileset.js:41:14)
    at Fileset.EventEmitter.emit (events.js:95:17)
    at Fileset.next (/vagrant/node_modules/glob/glob.js:343:12)
    at Fileset.Glob._processEmitQueue (/vagrant/node_modules/glob/glob.js:310:12)
    at Fileset.Glob.emitMatch (/vagrant/node_modules/glob/glob.js:290:8)
    at Fileset.Glob._finish (/vagrant/node_modules/glob/glob.js:230:8)
    at Fileset.<anonymous> (/vagrant/node_modules/glob/glob.js:183:27)
    at Fileset.cb (/vagrant/node_modules/glob/glob.js:368:11)
    at Fileset.<anonymous> (/vagrant/node_modules/glob/glob.js:483:32)
    at Fileset.cb (/vagrant/node_modules/glob/glob.js:368:11)
    at Fileset.<anonymous> (/vagrant/node_modules/glob/glob.js:483:32)
    at Fileset.cb (/vagrant/node_modules/glob/glob.js:368:11)
    at Fileset.<anonymous> (/vagrant/node_modules/glob/glob.js:483:32)
    at Fileset.cb (/vagrant/node_modules/glob/glob.js:368:11)
    at Fileset.<anonymous> (/vagrant/node_modules/glob/glob.js:483:32)
    at Fileset.cb (/vagrant/node_modules/glob/glob.js:368:11)
    at Fileset.<anonymous> (/vagrant/node_modules/glob/glob.js:483:32)
    at Fileset.cb (/vagrant/node_modules/glob/glob.js:368:11)
    at Fileset.<anonymous> (/vagrant/node_modules/glob/glob.js:483:32)
    at Fileset.cb (/vagrant/node_modules/glob/glob.js:368:11)
    at Fileset.<anonymous> (/vagrant/node_modules/glob/glob.js:483:32)
    at Fileset.cb (/vagrant/node_modules/glob/glob.js:368:11)
    at Fileset.<anonymous> (/vagrant/node_modules/glob/glob.js:483:32)
    at Fileset.cb (/vagrant/node_modules/glob/glob.js:368:11)
    at Fileset.<anonymous> (/vagrant/node_modules/glob/glob.js:483:32)
    at Fileset.cb (/vagrant/node_modules/glob/glob.js:368:11)
    at Fileset.<anonymous> (/vagrant/node_modules/glob/glob.js:483:32)
    at Fileset.cb (/vagrant/node_modules/glob/glob.js:368:11)
    at Fileset.<anonymous> (/vagrant/node_modules/glob/glob.js:483:32)
    at Fileset.cb (/vagrant/node_modules/glob/glob.js:368:11)
    at Fileset.<anonymous> (/vagrant/node_modules/glob/glob.js:483:32)
    at Fileset.cb (/vagrant/node_modules/glob/glob.js:368:11)
    at Fileset.<anonymous> (/vagrant/node_modules/glob/glob.js:483:32)
    at Fileset.cb (/vagrant/node_modules/glob/glob.js:368:11)
    at Fileset.<anonymous> (/vagrant/node_modules/glob/glob.js:483:32)
    at Fileset.cb (/vagrant/node_modules/glob/glob.js:368:11)
    at Fileset.<anonymous> (/vagrant/node_modules/glob/glob.js:483:32)
    at Fileset.cb (/vagrant/node_modules/glob/glob.js:368:11)
    at Fileset.<anonymous> (/vagrant/node_modules/glob/glob.js:483:32)
    at Fileset.cb (/vagrant/node_modules/glob/glob.js:368:11)
    at Fileset.<anonymous> (/vagrant/node_modules/glob/glob.js:483:32)
    at Fileset.cb (/vagrant/node_modules/glob/glob.js:368:11)
    at Fileset.<anonymous> (/vagrant/node_modules/glob/glob.js:483:32)
    at Fileset.cb (/vagrant/node_modules/glob/glob.js:368:11)
    at Fileset.<anonymous> (/vagrant/node_modules/glob/glob.js:483:32)
    at Fileset.cb (/vagrant/node_modules/glob/glob.js:368:11)
    at Fileset.<anonymous> (/vagrant/node_modules/glob/glob.js:483:32)
    at Fileset.cb (/vagrant/node_modules/glob/glob.js:368:11)
    at Fileset.<anonymous> (/vagrant/node_modules/glob/glob.js:483:32)
    at Fileset.cb (/vagrant/node_modules/glob/glob.js:368:11)
    at Fileset.<anonymous> (/vagrant/node_modules/glob/glob.js:483:32)
    at Fileset.cb (/vagrant/node_modules/glob/glob.js:368:11)
    at Fileset.<anonymous> (/vagrant/node_modules/glob/glob.js:483:32)
    at Fileset.cb (/vagrant/node_modules/glob/glob.js:368:11)
    at Fileset.<anonymous> (/vagrant/node_modules/glob/glob.js:450:14)
    at Fileset.Glob._afterReaddir (/vagrant/node_modules/glob/glob.js:695:17)
    at Object.oncomplete (fs.js:107:15)
npm ERR! weird error 8
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! not ok code 0

Launch Server Failure

vagrant@vagrant-ubuntu-trusty-64:/vagrant$ nodemon
24 Apr 19:00:34 - [nodemon] v1.3.7
24 Apr 19:00:34 - [nodemon] to restart at any time, enter `rs`
24 Apr 19:00:34 - [nodemon] watching: *.*
24 Apr 19:00:34 - [nodemon] starting `node server.js`

util.js:555
  ctor.prototype = Object.create(superCtor.prototype, {
                                          ^
TypeError: Cannot read property 'prototype' of undefined
    at Object.exports.inherits (util.js:555:43)
    at Object.<anonymous> (/vagrant/node_modules/http-proxy/lib/http-proxy/index.js:108:17)
    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)
    at require (module.js:380:17)
    at Object.<anonymous> (/vagrant/node_modules/http-proxy/lib/http-proxy.js:4:17)
    at Module._compile (module.js:456:26)
24 Apr 19:00:38 - [nodemon] app crashed - waiting for file changes before starting...
philmcm commented 9 years ago

I am seeing this problem too on RHEL 6. I believe the error is occurring in the lib/modules/es-proxy.js code, but I'm not sure how to progress it. I note that the dependency is on v1.3.0 of the http-proxy code, and the current version is v1.11.1, looks like the API has changed too. I'll keep looking.

jiamo commented 9 years ago

ubuntu 14.10 same error:

warn: --minUptime not set. Defaulting to: 1000ms warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms Loading config from /home/engine/.opensoc-ui Loading config from /home/engine/.opensoc-ui

util.js:555
  ctor.prototype = Object.create(superCtor.prototype, {
                                          ^
TypeError: Cannot read property 'prototype' of undefined
    at Object.exports.inherits (util.js:555:43)
    at Object.<anonymous> (/usr/local/lib/node_modules/opensoc-ui/node_modules/http-proxy/lib/http-proxy/index.js:108:17)
    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)
    at require (module.js:380:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/opensoc-ui/node_modules/http-proxy/lib/http-proxy.js:4:17)
    at Module._compile (module.js:456:26)
worker 95209 died

util.js:555
  ctor.prototype = Object.create(superCtor.prototype, {
                                          ^
TypeError: Cannot read property 'prototype' of undefined
    at Object.exports.inherits (util.js:555:43)
    at Object.<anonymous> (/usr/local/lib/node_modules/opensoc-ui/node_modules/http-proxy/lib/http-proxy/index.js:108:17)
    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)
    at require (module.js:380:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/opensoc-ui/node_modules/http-proxy/lib/http-proxy.js:4:17)
    at Module._compile (module.js:456:26)
worker 95210 died
error: Forever detected script exited with code: 0
philmcm commented 9 years ago

Hi. I got it working! :-) I wrote a small express app with a dependency on http-proxy version 1.3.0. It crashed with the same error. I found that by removing the dependency on http-proxy 1.3.0 in the package.json file, and updating it to version 1.11.1, everything works. Hope this helps. I'll submit a pull request as soon as I can.

jiamo commented 9 years ago

We can see https://travis-ci.org/OpenSOC/opensoc-ui/builds/58856546 how to success.