-
Notifications
You must be signed in to change notification settings - Fork 24.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Duplicate fbjs dependencies leading to "Error: Naming collision detected" #5467
Comments
According to facebook/fbjs#97 (comment) having multiple copies of fbjs in a React Native project will be supported in 0.19. 👍 |
great news :) |
It'll probably be 0.20 since the patches haven't landed yet but yes support is coming. |
I've had this issue before with facebook's flux library. Before this fix comes out, you can either update every dependency you have so they're on the same version of fbjs, or downgrade your dependencies to when they didn't use fbjs yet (for flux this was 2.0.1) Hope this helps |
For people that are still facing this issue, a temporary can be to add |
@jrichardlai 's suggestion solved it! |
Ran into this just now upgrading RN 0.17.0 -> 0.18.1. In case it helps anyone else, here's the error I got:
And here's what fixed it:
I'm guessing some of these steps may be extraneous and order may not matter, but in any case this got me going again. Thanks. |
jrichardlai YOU DAHH MANN |
Note - fbjs@0.6.0 may be needed as latest fbjs doesn't export the necessary modules. As per facebook/fbjs#95. I guess this will soon all be sorted out and these hacks won't be required. Also, rather than removing files I used a project rn-cli.config.js that adds the fbjs paths to the blacklist. |
@lrettig I used |
@ide do you know if this landed in 0.20-rc? I didn't see a mention in the release notes. |
Ok I tried to upgrade, but unfortunately I'm saddened to report that |
The fix (#5084) is still pending (some internal FB issues). |
Check here to solve this issue. 👏👍😃 |
@iTonyYo This not work at me. |
I have tried again with 0.21-rc, still not working. It's been breaking every release since 0.18 for me. Right now I have a naming collision between |
I battled with this for a long time, and finally got it working by doing the folowing:
For those that don't already have an rn-cli.config.js file, this lives in the root directory, alongside the index.ios.js and index.android.js files. |
I resolved it by updating fbemitter 0.9.1 to 0.9.2 |
npm ddp fixed the issue for me |
This should be fixed in 0.22-rc (#5084). |
This issue has been reported in #5180, #5357, #6164, #5390 and #5412 (so it's a pretty visible one!). Consolidating here to have a place to discuss solutions.
The Issue
Errors are of the following form (although the exact file that collides isn't always the same):
It appears the problem is with the packager, which globally resolves
@providesModule
annotations, vs npm, which can install different versions of the same module at different points in the tree, leading to collisions. A lot of people are running into this now thatreact-native
depends onreact
, which both depend onfbjs
. It has also been reported with other Facebook dependencies includingflux
andfbemitter
.Current Workarounds
node_modules
, upgrade to npm@3, and reinstall everything. npm@3 makes an effort to dedupe dependencies if the accepted versions overlap.node_modules
, installfbjs
as a top-level dependency and manually delete all nestedfbjs
instances (Naming collision: flux/node_modules/fbjs/flow/include/ErrorUtils.js #5390 (comment))I think option 1 is cleaner, and we should update the docs to recommend npm@3 unless we find a better short-term solution to this issue.
Possible Solutions
packager/blacklist.js
, maybe this could be used to ignore the conflicting react/fbjs dependencies.fbjs
, but if it isn't in many places it could be removed entirely.@providesModule
annotations in the version pushed publicly on npm and rely on relativerequire
statements. Long-term I see this as being a more stable solution, because npm's nested dependencies will never play nicely with a parallel global system. I suspect we'll keep seeing issues about this pop up whenever someone includes two Facebook projects with differentfbjs
versions. But, this solution is probably impossible because of how widely usedfbjs
is with Facebook.Other options?
The text was updated successfully, but these errors were encountered: