React-native-firebase: Unable to resolve module `react-native/Libraries/EventEmitter/EventEmitter`

Created on 5 Sep 2017  路  11Comments  路  Source: invertase/react-native-firebase

Issue

Updated my project to RN 0.48.1 and React 16.0.0-alpha.12. The project compiles properly and but now getting red screen of death in the iOS Simulator - both from Xcode and with RN CLI - with the following error message:

Bundling index.ios.js [development, non-minified, hmr disabled] 98.5% (766/772), failed.
error: bundling failed: "Unable to resolve module react-native/Libraries/EventEmitter/EventEmitter from /Volumes/VLO/apps/focoapp/app/node_modules/react-native-firebase/lib/modules/base.js: Module does not exist in the module map

This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:

  1. Clear watchman watches: watchman watch-del-all.
  2. Delete the node_modules folder: rm -rf node_modules && npm install.
  3. Reset packager cache: rm -fr $TMPDIR/react-* or npm start -- --reset-cache."

Environment

  1. Application Target Platform: iOS
  2. Development Operating System: El Capitan v10.11.6
  3. Build Tools: Xcode 8.2.1
  4. React Native version: 0.48.1
  5. RNFirebase Version: 2.1.4
  6. Firebase Module: Database, Auth, Storage, Crash, RemoteConfig
Build Error Bug

Most helpful comment

Looks like EventEmitter.js was removed from the EventEmitter library as of RN 0.48.

This seems to be the fix - in react-native-firebase/lib/modules/base.js change

import EventEmitter from 'react-native/Libraries/EventEmitter/EventEmitter';

to

import EventEmitter from 'react-native/Libraries/vendor/emitter/EventEmitter';

All 11 comments

Looks like EventEmitter.js was removed from the EventEmitter library as of RN 0.48.

This seems to be the fix - in react-native-firebase/lib/modules/base.js change

import EventEmitter from 'react-native/Libraries/EventEmitter/EventEmitter';

to

import EventEmitter from 'react-native/Libraries/vendor/emitter/EventEmitter';

Yeah very annoying! That fix will work as a temp workaround in v2 however we can't apply that as it wont be backwards compatible. v3 addresses this when it's released!

Can you release a 2.2 branch for RN 0.48+? :)

@lovince solution works fine. I created a PR #387 for that. You can install this manually by installing this branch:

yarn upgrade 'react-native-firebase@jerolimov/react-native-firebase#eb2ec4b0471865f151b7d32cc0bd7ffe8b314485'

I'm reproducing the same error on bundling/running on simulator. Since RN upgrade to 0.48.1

I'm not seeing this with @jerolimov's PR, but I'm only testing on iOS.

@Salakar What do you want to do about this?

@SoldierCorp This is a different issue, there's plenty of these in the issues.

+1 to 2.2 branch for RN 0.48+

+1

Will release a version in the next hour or so with this patched to support 48 and previous versions, the PR above would break <48

v2.2.0 is up.

i did yarn upgrade, and made react-native-root-siblings upgrade from 1.2.1 to 1.3.0, and the error raised. then i delete yarn.lock, and did yarn install, and the error gone.

yarn add react-native-root-toast to upgrade it from 1.1.2 to 2.2.0 also fix the error

Was this page helpful?
0 / 5 - 0 ratings