Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to resolve module react-native/Libraries/EventEmitter/EventEmitter #386

Closed
lovince opened this issue Sep 5, 2017 · 13 comments
Closed
Assignees
Labels
Impact: Bug New bug report Impact: Build Error Behaviour causing build failure

Comments

@lovince
Copy link

lovince commented Sep 5, 2017

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 facebook/react-native#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
@lovince
Copy link
Author

lovince commented Sep 5, 2017

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';

@Ehesp
Copy link
Member

Ehesp commented Sep 5, 2017

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!

@jerolimov
Copy link
Contributor

jerolimov commented Sep 5, 2017

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'

@fungilation
Copy link
Contributor

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

@fungilation
Copy link
Contributor

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

@Ehesp
Copy link
Member

Ehesp commented Sep 6, 2017

@Salakar What do you want to do about this?

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

@fungilation
Copy link
Contributor

+1 to 2.2 branch for RN 0.48+

@lovince
Copy link
Author

lovince commented Sep 6, 2017

+1

@Salakar
Copy link
Member

Salakar commented Sep 6, 2017

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

@Salakar
Copy link
Member

Salakar commented Sep 7, 2017

v2.2.0 is up.

@Salakar Salakar closed this as completed Sep 7, 2017
@Salakar Salakar self-assigned this Sep 7, 2017
@Salakar Salakar added Impact: Build Error Behaviour causing build failure Impact: Bug New bug report labels Sep 7, 2017
sameesiddiqui added a commit to sameesiddiqui/react-native-root-siblings that referenced this issue Oct 2, 2017
EventEmitter removed from RN in .48. Updated to new location.
Reference: invertase/react-native-firebase#386
@AlexanderYao
Copy link

AlexanderYao commented Nov 21, 2017

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

@cs-manughian
Copy link

cs-manughian commented Nov 26, 2023

@sameesiddiqui @jerolimov @lovince I am still getting this error with the fix in.

This is the error:

ERROR in ./node_modules/@react-native-firebase/app/lib/internal/SharedEventEmitter.js:18
Module not found: Can't resolve 'react-native/Libraries/vendor/emitter/EventEmitter'
  16 |  */
  17 |
> 18 | import EventEmitter from 'react-native/Libraries/vendor/emitter/EventEmitter';
  19 |
  20 | export default new EventEmitter();

Does anyone know a solution? I can't get the application running using expo start --web

  "dependencies": {
    "@react-native-firebase/app": "^18.6.2",
    "@react-native-firebase/auth": "^18.6.2",
    "@react-native-firebase/firestore": "^18.6.2",
    "chess.js": "^1.0.0-beta.6",
    "expo": "~49.0.13",
    "expo-build-properties": "~0.8.3",
    "expo-status-bar": "~1.6.0",
    "expo-updates": "^0.18.17",
    "react": "18.2.0",
    "react-native": "^0.72.6"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@expo/webpack-config": "^19.0.0",
    "@types/react": "~18.2.14",
    "expo-env-info": "^1.0.5",
    "react-dom": "^18.2.0",
    "react-native-web": "^0.19.9",
    "typescript": "^5.1.3"
  },

I found this thread on Reddit -- is this true? Didn't see it in the docs that it doesn't work with expo web emulator
https://www.reddit.com/r/expo/comments/16illkb/does_expo_web_just_not_work_with_firebase/

@mikehardy
Copy link
Collaborator

I have no idea how react-native-firebase (heavy emphasis on the native) would work on the web. We have plans to bridge the APIs such that it works on react-native-web (the underlying technology of Expo Web...) by delegating to the firebase-js-sdk in that case but no work has begun there. It is not going to work. You must do native builds and run on either android or ios as far as I know

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Impact: Bug New bug report Impact: Build Error Behaviour causing build failure
Projects
None yet
Development

No branches or pull requests

8 participants