reactivesearch icon indicating copy to clipboard operation
reactivesearch copied to clipboard

Uncaught TypeError: Emitter is not a constructor

Open Gittekken opened this issue 8 years ago • 9 comments

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

Gittekken avatar Apr 09 '18 18:04 Gittekken

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

metagrover avatar Apr 09 '18 18:04 metagrover

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.

Gittekken avatar Apr 10 '18 01:04 Gittekken

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.

divyanshu013 avatar Apr 10 '18 05:04 divyanshu013

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 avatar Apr 10 '18 08:04 Gittekken

@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 avatar Apr 10 '18 09:04 siddharthlatest

@siddharthlatest thanks nice find on the stream issue. Ken

Gittekken avatar Apr 11 '18 00:04 Gittekken

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

abathellier avatar May 24 '18 13:05 abathellier

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 avatar May 31 '18 09:05 Gittekken

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

Gittekken avatar May 31 '18 09:05 Gittekken