appbaseio / reactivesearch

Search UI components for React and Vue
https://opensource.appbase.io/reactivesearch
Apache License 2.0
4.89k stars 466 forks source link

Uncaught TypeError: Emitter is not a constructor #323

Closed Gittekken closed 6 years ago

Gittekken commented 6 years ago

Hi, when i try to import reactivesearch I get an error of "Uncaught TypeError: Emitter is not a constructor". I was wondering how to go about solving this issue.

thanks Ken

metagrover commented 6 years ago

Hi @Gittekken, which version of reactivesearch are you using? Also, are you using it on web/native?

Gittekken commented 6 years ago

The latest version. "@appbaseio/reactivesearch": "^2.3.3". For the web. At the web console it says could not find module emitter so I npm installed it and now it says Uncaught TypeError: Emitter is not a constructor.

divyanshu013 commented 6 years ago

Can you post any errors you're seeing in the browser console and any relevant code? I tried the starter app and it seems to be working fine.

Gittekken commented 6 years ago

I am not using a starter app. I am using an existing meteor project.

I get this Unable to resolve some modules: "emitter" in /C/Users/.../Documents/.../node_modules/stream/index.js (web.browser) "bufferutil" in /C/Users/.../Documents/.../node_modules/ws/lib/BufferUtil.js (web.browser) "utf-8-validate" in /C/Users/.../Documents/.../node_modules/ws/lib/Validation.js (web.browser)

If you notice problems related to these missing modules, consider running: meteor npm install --save emitter bufferutil utf-8-validate

so I installed all of these with npm.

Once I installed them I get "Uncaught TypeError: Emitter is not a constructor" That is all I am seeing just that. There is nothing else.

siddharthlatest commented 6 years ago

@Gittekken On a first look, it seems like a meteor specific error caused by the stream package. I am not too familiar with the platform to comment, but found this thread where someone had a similar error - https://forums.meteor.com/t/emitter-is-not-a-constructor-meteor-1-3-and-npm/24587.

In the Github repo of the stream package, I found this issue which may be relevant - https://github.com/juliangruber/stream/issues/5.

Gittekken commented 6 years ago

@siddharthlatest thanks nice find on the stream issue. Ken

durdenx commented 6 years ago

Is there a solution ? I opened an issue on meteorjs repo.

Gittekken commented 6 years ago

sorry my memory is bad but yes!! you just change the line to "var Emitter = require('emitter');" in the index.js. just follow what was mentioned in link @siddharthlatest found. https://github.com/juliangruber/stream/issues/5

Gittekken commented 6 years ago

and obviously install the modules that meteor wants installed I believe. hope this helps.