invertase / react-native-firebase

🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.65k stars 2.21k forks source link

error: bundling failed: Error: Unable to resolve module `@react-native-firebase/app` from `/Users/primetimetran/Desktop/rnTodoList/App.js`: Module `@react-native-firebase/app` does not exist in the Haste module map #2355

Closed PrimeTimeTran closed 4 years ago

PrimeTimeTran commented 5 years ago

🔥 Unable to resolve module @react-native-firebase/app

error: bundling failed: Error: Unable to resolve module `@react-native-firebase/app` from `/Users/primetimetran/Desktop/rnTodoList/App.js`: Module `@react-native-firebase/app` does not exist in the Haste module map

I built this app following this guide(awesome work btw guys).

I used the starter app.

I even made a short video to demonstrate.

However, after I began updating the app to hooks today I started getting this error.

I didn't change package.json or anything. I've tried removing package-lock.json & npm installing again.

Any suggestions?


Project Files

iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby # Uncomment the next line to define a global platform for your project platform :ios, '9.0' target 'rnTodoList' do # Pods for rnTodoList # Uncomment the next line if you're using Swift or would like to use dynamic frameworks # use_frameworks! # Required by RNFirebase pod 'Firebase/Core', '~> 6.3.0' # [OPTIONAL PODS] - comment out pods for firebase products you won't be using. # pod 'Firebase/AdMob', '~> 6.3.0' pod 'Firebase/Auth', '~> 6.3.0' pod 'Firebase/Database', '~> 6.3.0' pod 'Firebase/Functions', '~> 6.3.0' pod 'Firebase/DynamicLinks', '~> 6.3.0' pod 'Firebase/Firestore', '~> 6.3.0' pod 'Firebase/Messaging', '~> 6.3.0' pod 'Firebase/RemoteConfig', '~> 6.3.0' pod 'Firebase/Storage', '~> 6.3.0' pod 'Firebase/Performance', '~> 6.3.0' pod 'Fabric', '~> 1.10.2' pod 'Crashlytics', '~> 3.13.2' end target 'rnTodoList-tvOS' do # Uncomment the next line if you're using Swift or would like to use dynamic frameworks # use_frameworks! # Pods for rnTodoList-tvOS target 'rnTodoList-tvOSTests' do inherit! :search_paths # Pods for testing end end ``` #### `AppDelegate.m`: ```objc /** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #import "AppDelegate.h" #import #import #import #import @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [FIRApp configure]; RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"rnTodoList" initialProperties:nil]; rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; UIViewController *rootViewController = [UIViewController new]; rootViewController.view = rootView; self.window.rootViewController = rootViewController; [self.window makeKeyAndVisible]; return YES; } - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; #else return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; #endif } @end ```


Android

Click To Expand

#### Have you converted to AndroidX? - [ ] my application is an AndroidX application? - [ ] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ ] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`: ```groovy // N/A ``` #### `android/app/build.gradle`: ```groovy // N/A ``` #### `android/settings.gradle`: ```groovy // N/A ``` #### `MainApplication.java`: ```java // N/A ``` #### `AndroidManifest.xml`: ```xml ```


Environment

Click To Expand

**`react-native info` output:** ``` React Native Environment Info: System: OS: macOS 10.14.5 CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz Memory: 1.37 GB / 32.00 GB Shell: 5.3 - /bin/zsh Binaries: Node: 10.15.2 - /usr/local/opt/node@10/bin/node Yarn: 1.15.2 - /usr/local/bin/yarn npm: 6.4.1 - /usr/local/opt/node@10/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2 IDEs: Android Studio: 3.4 AI-183.5429.30.34.5452501 Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild npmPackages: react: 16.8.3 => 16.8.3 react-native: 0.59.9 => 0.59.9 npmGlobalPackages: react-native-cli: 2.0.1 ``` - **Platform that you're experiencing the issue on**: - [x] iOS - [ ] Android - [x] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `^5.5.4` - **`Firebase` module(s) you're using that has the issue:** - `@react-native-firebase/app` - **Are you using `TypeScript`?** - `No`


Thanks for your awesome work so far team!

nxz91 commented 5 years ago

I'm getting this with the messaging module on react-native 0.60.3:

error: bundling failed: Error: Unable to resolve module `react-native-firebase/messaging` from `/Users/leonardwitteler/Repositories/Yotribe/v2/v0.60.3/src/util/firebase-messaging.js`: Module `react-native-firebase/messaging` does not exist in the Haste module map

stale[bot] commented 5 years ago

Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?

This issue will be closed in 15 days if no further activity occurs. Thank you for your contributions.

vikrantshroti commented 5 years ago

stop your package manager and start it with npm start --reset-cache

Ehesp commented 5 years ago

It looks like you've installed v5 of RNFB, but tried to use a v6 import.

stale[bot] commented 4 years ago

Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?

This issue will be closed in 15 days if no further activity occurs. Thank you for your contributions.

AdamMoffitt commented 4 years ago

Im getting this error message too, both when trying to implement react-native-firebase in an existing react-native project and when trying to start a new react-native-firebase project.

AdamMoffitt commented 4 years ago

Any fix for this? Also getting "bundling failed: Error: Unable to resolve module react-navigation from /Users/.../Desktop/ReferMD/App.js: Module react-navigation does not exist in the Haste module map

rahul-tk-60 commented 4 years ago

I'm getting this with the messaging module on react-native 0.60.0: bundling failed: Error: Unable to resolve module react from D:\***\****\App.js: Module react does not exist in the Haste 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 Metro Bundler cache: rm -rf /tmp/metro-bundler-cache-* or npm start -- --reset-cache.
  4. Remove haste cache: rm -rf /tmp/haste-map-react-native-packager-*.

i have clear the cache and rebuild the application , then also it showing the same error.

mikehardy commented 4 years ago

That's not enough information to resolve anything. It will be project-specific though. I'm not sure which version of react-native-firebase you are using, but the best I can do with this information is point to two scripts I wrote which demonstrate things working correctly if you run them following instructions:

https://github.com/mikehardy/rnfbdemo/blob/master/make-demo-v6.sh https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh

hackrx commented 4 years ago

I'm getting this with the messaging module on react-native 0.60.0: bundling failed: Error: Unable to resolve module react from D:\***\****\App.js: Module react does not exist in the Haste 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 Metro Bundler cache: rm -rf /tmp/metro-bundler-cache-* or npm start -- --reset-cache.
  4. Remove haste cache: rm -rf /tmp/haste-map-react-native-packager-*.

i have clear the cache and rebuild the application , then also it showing the same error.

I am getting the same problem. Anyone can please help me here.

appukuttan-shailesh commented 4 years ago

@rahul-tk-60 , @hackrx : How did you both fix this problem?

hackrx commented 4 years ago

@rahul-tk-60 , @hackrx : How did you both fix this problem?

I exactly don't remember what I did, but You can try npm clean cache -force or if didn't work, delete the node modules folder and again run npm install , make sure firebase package module is mentioned in the package.json, And one more thing in react 0.60 version linking is done automatically, but sometimes it causes error, so u can perform manual changes (which is mentioned on the npmjs.com) like adding some code inside Android files so make sure you have done that changes.

mikehardy commented 4 years ago

npx react-native-clean-project - it is the gold standard

appukuttan-shailesh commented 4 years ago

Thanks for the replies @hackrx, @mikehardy I shall try this next time. This time I uninstalled the last package that I had installed (npm i react-native-firebase) and it worked. I later realized that his package was outdated, and that I should have gone with npm install @react-native-firebase/app.

arshadazaad3 commented 3 years ago

If you have received this error after installing @react-native-firebase/auth

First Install @react-native-firebase/app

Byusa commented 3 years ago

This fixed it for me:

  1. Clear watchman watches: watchman watch-del-all.
  2. Delete the node_modules folder: rm -rf node_modules && npm install.
  3. Reset Metro Bundler cache: npm start -- --reset-cache.
  4. Remove haste cache: rm -rf /tmp/haste-map-react-native-packager-*
mikehardy commented 3 years ago

aka npm react-native-clean-project :-)

Mazhar-khan commented 3 years ago

Error: While resolving module firebase/auth, the Haste package firebase was found. However the module auth could not be found within the package.

mikehardy commented 3 years ago

@Mazhar-khan here is a script that generates a complete sample project that works, something in your project is different and thus not working - between the two is the problem but the problem is not in this module

https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh