-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Error: jest-haste-map: @providesModule naming collision #21242
Comments
Since this has more to do with Metro than it does with react native, it may be more productive to have this discussion over at facebook/metro instead of here. |
I've opened the issue at the metro's repo, as suggested: facebook/metro#265 While this has to do with Metro, it seems to be caused by react-native's usage of Metro, since metro provides a way for applications to be configured and avoid this error, which can be used in react-native's applications through |
As I've suggested in the linked Metro issue, I think that the fix should be done in the default Metro config for RN apps (which lives here). |
I'm getting same error. In my case has to do with using a local module in In my APP
In my
So when running Looking for JS files in
/Users/R01/Projects/RNApp
/Users/R01/Projects/react-native-services
Metro Bundler ready.
Loading dependency graph...(node:72824) UnhandledPromiseRejectionWarning: Error: jest-haste-map: @providesModule naming collision:
Duplicate module name: Sample
Paths: /Users/R01/Projects/react-native-services/node_modules/react-native/Libraries/Sample/package.json collides with /Users/R01/Projects/RNApp/node_modules/react-native/Libraries/Sample/package.json
This error is caused by a @providesModule declaration with the same name across two different files.
at setModule (/Users/R01/Projects/RNApp/node_modules/jest-haste-map/build/index.js:446:17)
at workerReply (/Users/R01/Projects/RNApp/node_modules/jest-haste-map/build/index.js:496:9)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:182:7)
(node:72824) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:72824) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
error: bundling failed: Error: jest-haste-map: @providesModule naming collision:
Duplicate module name: Sample
Paths: /Users/R01/Projects/react-native-services/node_modules/react-native/Libraries/Sample/package.json collides with /Users/R01/Projects/RNApp/node_modules/react-native/Libraries/Sample/package.json
This error is caused by a @providesModule declaration with the same name across two different files.
at setModule (/Users/R01/Projects/RNApp/node_modules/jest-haste-map/build/index.js:446:17)
at workerReply (/Users/R01/Projects/RNApp/node_modules/jest-haste-map/build/index.js:496:9)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:182:7) |
@r01010010 Did you resolve this? I'm having the same issue. |
@r01010010 Did you resolve this issue? I am getting same issue for saleforce mobile sdk sample code This error is caused by |
This link is dead, FYI. |
This happened to me after linking App Center's SDK's The first error message reads:
|
I start to get this error after upgrading to rn 0.57.7. the jsbundler started to complain about every npm package that includes react-native. so I added
|
Is that a fix or just triage @jamalx31? |
@mjstelly a fix. at least in my case. |
@jamalx31 This is not working in my case. same problem. when I tried to make bundle I am getting following error
Error: jest-haste-map: Haste module naming collision: This error is caused by can anybody suggest how to resolve this? |
@mosinbagban I think it didn't work for you cuz you are on Windows. try to update the regex. probably this will work for you |
Link to the Metro issue facebook/metro#265, please refer to that. |
Ok. Thanks!
Sincerely,
Michael Stelly | M: +1.918.978.2000 | LinkedIn
<http://www.linkedin.com/in/mstelly> | Twitter
<https://twitter.com/michaelstelly>
…On Wed, Dec 12, 2018 at 10:03 AM Lorenzo Sciandra ***@***.***> wrote:
Closed #21242 <#21242>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#21242 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AATJ2-ff_DDKQZ7BryGeBylRrLvFHidWks5u4RragaJpZM4Wz2MX>
.
|
im having this problem but on react-native-desktop |
I'm getting same issue here, Error: jest-haste-map: Haste module naming collision: This error is caused by This error is caused by |
I have same issue, please help |
Same issue after upgrade react-native to latest version :/ |
Same issue in RN 0.59.4, this is my Podfile: target 'mynewapp' do -- Pods for mynewapp -- Pods for ReactPushNotifications - Add these lines pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler' target 'mynewapp-tvOSTests' do target 'mynewappTests' do end |
@jamalx31 could you please let me know where to add this code? const blacklist = require('metro-config/src/defaults/blacklist');
|
@muhammadwfa you need to create |
Please check out this solution. It was the problem I had, and the answer helped me get it solved: |
@muhammadwfa I had to put it in metro.config.js instead of rn-cli.config.js. I also had to use the solution posted in the post above mine, configuring my podfile to specifically resolve react as ../node_modules/react-native. Without these two tweaks I was constantly running into issues with things linking to the wrong version of react. |
I still couldn't get it to work, even with updating the It turns out my issue was that there was an unused |
I am getting this error because the project is nested. this mean project in project . |
Same error on RN 0.59.X
|
OK About to board a plane so can't find out which bit worked but following metro config works finally: `/**
module.exports = { |
@lupelius Could you please post a well formatted code snippet, of you can made a gist on GitHub, as it seems that there is a missing characters and It gives a regular expression error. |
Also have this isse with 0.59. Like @leemcmullen said I've got a new React folder in Pods since I've installed |
surprisingly this fixes the issue in my case, even though I as compiling for android release. thx man. |
I just replaced |
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: