-
Notifications
You must be signed in to change notification settings - Fork 623
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
RN - Error: jest-haste-map: @providesModule naming collision #265
Comments
Hi! Thanks for reporting! The metro resolution logic (which is powered by This should be done in the default Metro config for RN apps (which lives here), IMHO it should be fine to always add the build folders in the blacklist of Metro, since nothing should be resolved from there. |
Hi! Thank you for the answer. Is there a way this could be done from inside the plugin code? |
Unfortunately there's no way for plugins to modify the config object, what you can do is implement some util method in |
i have added
|
solved it by changing the conflict making libraries to old version |
solved by adding
|
Why Metro doesn't honor the following config in the package.json ?
(see the modulePathIgnorePatterns option) |
@jaimecbernardo confirmed your solution works by adding: const blacklist = require('metro-config/src/defaults/blacklist');
module.exports = {
resolver:{
blacklistRE: blacklist([
/nodejs-assets\/.*/,
/android\/.*/,
/ios\/.*/
])
},
}; |
Can anyone tell me where to use this below code const blacklist = require('metro-config/src/defaults/blacklist'); |
@RavichandraBadeka Please format your code with Markdown. |
Workaround not working for me when trying to refactor part of an Expo app into a common module. Issue at expo/expo#3713 if anyone has any clues if it's my error or a deeper bug. |
@RavichandraBadeka simply put the code in a file, name it |
@shreyasb07 I see you have metro.config.js there too. I think in newer versions metro uses that instead of |
@thg303 thanks a lot. you saved my day |
@thg303 thank you so much, that works! I really appreciate it! |
Thank you @thg303 . metro/packages/metro-config/src/loadConfig.js Lines 65 to 68 in 0393cdf
|
I'm getting this error after adding blacklist.
|
I get this error by following the official tutorial from Facebook React Native |
Ok, I got the solution after 3 days of trials with everything I could find on the internet. Add this in your podfile:
Then in your ios folder, do:
That last line might seem obvious for most of you but it was not for me as I usually let react-native handle everything that happens at ios or android level. |
I have same error. I tried remove node module many time but didn't solve problem. And then I open 1 tab run open another tab run |
Only this works for me, I don't know how many other issues i am going to face for this. module.exports = { |
not working for me anything.. :( |
This is my metro.config.js (I know I don't need both resolver and transformer.getBlacklistRE before you say it, I wanted to show I tried a couple things) and I also tried mymai91's suggestion to reset cache on one tab and run ios on a second one, nothing is working... I've been on this stuck for two days, every time you install a new package and link, react native stops working, it's so frustrating `/**
module.exports = { |
OK About to board a plane so can't find out which bit worked but following metro config works finally, wanted to share: `/**
module.exports = { |
@lupelius Awesome! What worked for you? Im on this now |
did you manage to find a fix? |
Exactly same error, did you manage to fix it..? |
Same error. did you fix it ? |
you saved my day 💯 |
Okay, I am confused, I have this
and it was not because of this error, I just recently started getting this error and then I added
So what am I supposed to be doing? Merging both of these configurations? This is really doing a number when I try to create an |
Hi @ldco2016 , |
For someone from our days, blacklist was be renamed to blocklist, and
|
Reporting this error here as well, as suggested in the corresponding react-native issue: facebook/react-native#21242 (comment)
It's related to react-native's usage of metro, where a plugin might need to instruct metro to ignore some paths in the react-native project. Discussion here might helpful, as there might already be a way to achieve this.
Here's the original issue:
Environment
Description
The nodejs-mobile-react-native plugin runs a nodejs project in a react-native application. It creates a
nodejs-project
folder in the react-native's project root folder, which will be copied in the build process to be included in the mobile application assets, which means the Bundler will detect duplicate modules.Before react-native version
0.56
, this duplication caused a warning while the bundler was starting, but the mobile application was still able to function and get the react-native files from the bundler. In and after version0.56
, the bundler will now throw an error when the mobile application tries to get the bundle from the development machine:error: bundling failed: Error: jest-haste-map: @providesModule naming collision:
Before react-native version
0.56
, it was possible to use the plugin without creating arn-cli.config.js
file in the react-native project, as this was only a warning, but now creating arn-cli.config.js
file in the main project with a blacklist for the Metro bundler is mandatory for using the plugin: https://github.com/janeasystems/nodejs-mobile-react-native/tree/ed727edea17e8a9e1a85cef3413becc83b8a0328#duplicate-module-nameSince this is now an error that won't allow the application to work, is there something that can be done from inside the plugin to have the Metro bundler ignore some paths?
Thank you, in advance.
Reproducible Demo
Before react-native version
0.56
, the application is able to run successfully.The react packager throws warnings but the application can still run and get the bundle from the development machine:
In and after react-native version
0.56
, the application will fail to run due to the bundler failing:The same warning is still thrown but now there is an additional error when the application running in the device tries to get the bundle from the development machine:
Sometimes this error won't occur in the first run, so there's probably a timing issue here. If it doesn't occur in the first run, close the Metro Bundler and run
react-native run-android
again.The text was updated successfully, but these errors were encountered: