react-native-root-toast icon indicating copy to clipboard operation
react-native-root-toast copied to clipboard

EventEmitter Module doesn't exist Error

Open bhatti-waqas opened this issue 7 years ago • 13 comments

I get following error when try to add the toast. Please help out. simulator screen shot 17-oct-2017 10 28 12 am

bhatti-waqas avatar Oct 17 '17 05:10 bhatti-waqas

临时解决方案: 修改node_modules/react-native-root-siblings/lib/AppRegistryInjection.js 将import EventEmitter from 'react-native/Libraries/EventEmitter/EventEmitter'; 改为import EventEmitter from 'react-native/Libraries/vendor/emitter/EventEmitter'; 备注:RN的这个版本移动了emitter包的位置

xapm avatar Oct 18 '17 05:10 xapm

But How can I modify in native library??

bhatti-waqas avatar Oct 18 '17 05:10 bhatti-waqas

@magicismight Please make your root siblings module work with RN 0.48+, so we don't have to fork your stuff and create confusion. It will also be the answer to this bug report :)

Morriz avatar Oct 18 '17 08:10 Morriz

For the non chinese folks like me, @zylibin solution worked for me:

Find the file node_modules/react-native-root-siblings/lib/AppRegistryInjection.js

And replace line: import EventEmitter from 'react-native/Libraries/EventEmitter/EventEmitter'; With import EventEmitter from 'react-native/Libraries/vendor/emitter/EventEmitter';

kevando avatar Oct 29 '17 18:10 kevando

Those suggestions are no solutions, as such changes get overwritten on the next update...so please be aware of that and stop propagating such mess....

On 29 okt. 2017, at 19:06, Kevin Habich [email protected] wrote:

For the non chinese folks like me, @zylibin https://github.com/zylibin solution worked for me:

Find the file node_modules/react-native-root-siblings/lib/AppRegistryInjection.js

And replace line: import EventEmitter from 'react-native/Libraries/EventEmitter/EventEmitter'; With import EventEmitter from 'react-native/Libraries/vendor/emitter/EventEmitter';

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/magicismight/react-native-root-toast/issues/51#issuecomment-340281725, or mute the thread https://github.com/notifications/unsubscribe-auth/AA5fKcpsPS27kmf-v2fRzxJeh54FgvUHks5sxL67gaJpZM4P7mas.

Morriz avatar Oct 29 '17 18:10 Morriz

please use my fork in your package.json, this might be the most easy solution, just a work around:

"react-native-root-toast": "github:pilipa-cn/react-native-root-toast#v2.2.0"

beansoft avatar Nov 28 '17 07:11 beansoft

Is there any official fix for this?

Albinzr avatar Dec 04 '17 10:12 Albinzr

No, like @beansoftapp offered, and what more people are doing, which leads to a lot of (unmaintained) forks: fork your own, or use somebody else's fork (like @beansoftapp's)

That is why, ultimately, most open source advocates will gently keep nudging the original maintainer to update the package. So pretty please @magicismight ?

Morriz avatar Dec 04 '17 12:12 Morriz

I totally agree with @Morriz, so i'd like to talk how to fix this issue without touch the original source code at all. This bug occured as the author has specific the dependencies like this:

"dependencies": {
        "react-native-root-siblings": "^1.2.1"
    }

so the ^ will not lock the version of react-native-root-siblings, but the author released another new version of react-native-root-siblings which only works on latest react native. If you are using RN 0.46 ~ 0.48, you can run yarn first, then edit the yarn.lock file, and commit this file to your code base and other team member will using the same version as you, they just need do run a yarn. Now search and edit version number to this:

react-native-root-siblings@^1.2.1:
  version "1.2.1"
  resolved "https://registry.yarnpkg.com/react-native-root-siblings/-/react-native-root-siblings-1.2.1.tgz#6f8d0e711dbf9aef4e57e73aea751372b5aefcff"
  dependencies:
    static-container "^1.0.0"

react-native-root-toast@^1.1.2:
  version "1.1.2"
  resolved "https://registry.yarnpkg.com/react-native-root-toast/-/react-native-root-toast-1.1.2.tgz#1f5a2dad70743a9ab6b5d44674c8dda578523961"
  dependencies:
    react-native-root-siblings "^1.2.1"

in package.json: "react-native-root-toast": "1.1.2" Then you must run yarn again, this will make sure your local node_modules using the correct version.

beansoft avatar Dec 04 '17 13:12 beansoft

That's a nice hack iyam, the best so far ;)

Don't forget about it tho: you are then using a hack to use that version, so make sure to always be aware of that when ugrading your yarn.lock. Not ideal.

Morriz avatar Dec 04 '17 14:12 Morriz

For react-native >= 0.47 you can use [email protected], or using 1.2.1 for lower version.

magicismight avatar Dec 05 '17 06:12 magicismight

@magicismight so it might be kindly enough for you to add supported RN version range in the readme file. In fact this issue was first found after Nov 25, our CI breaks nightly build, after that I added yarn.lock file to our code base.

beansoft avatar Dec 05 '17 06:12 beansoft

Any proper solution found?

asnad avatar Jun 13 '18 11:06 asnad