Uncaught TypeError: Emitter is not a constructor
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
Hi @Gittekken, which version of reactivesearch are you using? Also, are you using it on web/native?
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.
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.
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.
@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.
@siddharthlatest thanks nice find on the stream issue. Ken
Is there a solution ? I opened an issue on meteorjs repo.
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
and obviously install the modules that meteor wants installed I believe. hope this helps.