Home > Software engineering >  React-native bundling failure. ERROR MESSAGE: "While trying to resolve module 'idb'..
React-native bundling failure. ERROR MESSAGE: "While trying to resolve module 'idb'..

Time:05-11

ERROR MESSAGE IN QUESTION:

While trying to resolve module idb from file C:\Users\OG\Desktop\programming\react_native\mealstogo\MealsToGo2\node_modules\@firebase\app\dist\esm\index.esm2017.js, the package C:\Users\OG\Desktop\programming\react_native\mealstogo\MealsToGo2\node_modules\idb\package.json was successfully found. However, this package itself specifies a main module field that could not be resolved (C:\Users\OG\Desktop\programming\react_native\mealstogo\MealsToGo2\node_modules\idb\build\index.cjs. Indeed, none of these files exist:

Error message photo

The confusing part of this error is that the file index.esm2017 does in fact exist at the directory. '`C:\Users\OG\Desktop\programming\react_native\mealstogo\MealsToGo2\node_modules\idb\build\index.cjs'

I have uninstalled and reinstalled firebase. I have installed and uninstalled 'idb'. I have cleared yarn cache, expo cache, deleted node_modules and reinstalled as well as cleared watchman cache all to no avail. I have also triple checked that the file directory is in fact where the error message says it isn't.

The error arose when expo installing lottie-react-native, however it seems unrelated, and the problem remained once removing lottie-react-native. I have used git to revert my code to before the behavior started and now the problem persists here as well.

It almost seems as the entire project is now trashed, how do I move forward.

CodePudding user response:

I get the same error... I think there's something funny about the new firebase version. I downgraded my firebase version to 9.6.11 to fix the issue temporarily...

npm uninstall firebase
npm install [email protected]

CodePudding user response:

Having the exact same issue even after adding firebase in a clean expo project. The issue is due to .cjs not supported in expo.

I fixed it by adding cjs into metro.config.js as described here: https://github.com/thysultan/stylis/issues/233#issuecomment-1000648356

CodePudding user response:

@crunchytoast thanks you a lot for your answer. I've been solved the same issue with: npm uninstall firebase npm install [email protected]

  • Related