Skip to content
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

"Naming collision detected" on start #5180

Closed
siuying opened this issue Jan 7, 2016 · 32 comments
Closed

"Naming collision detected" on start #5180

siuying opened this issue Jan 7, 2016 · 32 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@siuying
Copy link

siuying commented Jan 7, 2016

Found a "Naming collision detected" on launch, where a fbjs file is collides with another fbjs files ...

Error building DependencyGraph:
 Error: Naming collision detected: app/node_modules/fbjs/flow/include/CSSCore.js 
 collides with app/node_modules/fbjs/lib/CSSCore.js
react-native -v
react-native-cli: 0.1.8
react-native: 0.18.0-rc
@facebook-github-bot
Copy link
Contributor

Hey siuying, thanks for reporting this issue!

React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.

  • If you don't know how to do something or something is not working as you expect but not sure it's a bug, please ask on StackOverflow with the tag react-native or for more real time interactions, ask on Discord in the #react-native channel.
  • If this is a feature request or a bug that you would like to be fixed, please report it on Product Pains. It has a ranking feature that lets us focus on the most important issues the community is experiencing.
  • We welcome clear issues and PRs that are ready for in-depth discussion. Please provide screenshots where appropriate and always mention the version of React Native you're using. Thank you for your contributions!

@respectTheCode
Copy link
Contributor

I am running into the same problem

@fsp
Copy link

fsp commented Jan 8, 2016

I solved this issue by erasing fbjs from react native's node_modules folder.

@corbt
Copy link
Contributor

corbt commented Jan 11, 2016

I ran into this same issue when updating from react-redux 3 to 4. I tried @fsp's solution but it didn't fix it. I ended up blowing up the whole node_modules folder and reinstalling, and then doing what @FSB said, which fixed the issue for me.

I'm using 0.18-rc (but I've switched between 0.18-rc, 0.17 and master a number of times recently, so it's possible my node_modules folder was in a weird/inconsistent state).

@masom
Copy link

masom commented Jan 11, 2016

Happens on rm -rf node_modules && npm install with 0.18.0-rc

@ghost
Copy link

ghost commented Jan 19, 2016

Having the exact same issue with the fbjs package. Removing it manually did not fix it for me, because a conflict still exists but then in the node_modules/fbemitter directory.

@rclai
Copy link
Contributor

rclai commented Jan 20, 2016

I am also having this issue and none of the above solutions worked at all, even with npm cache clear:

[10:04:24 PM] <END>   Crawling File System (885ms)
[10:04:24 PM] <START> Building in-memory fs for JavaScript
[10:04:26 PM] <END>   Building in-memory fs for JavaScript (1573ms)
[10:04:26 PM] <START> Building in-memory fs for Assets
[10:04:27 PM] <END>   Building in-memory fs for Assets (1516ms)
[10:04:27 PM] <START> Building Haste Map
[10:04:29 PM] <START> Building (deprecated) Asset Map
[10:04:29 PM] <END>   Building (deprecated) Asset Map (612ms)
Error building DependencyGraph:
 Error: Naming collision detected: /home/rlai/react-projects/Todos/node_modules/react/node_modules/fbjs/lib/UserAgentData.js collides with /home/rlai/react-projects/Todos/node_modules/react-native/node_modules/fbjs/lib/UserAgentData.js
    at HasteMap._updateHasteMap (HasteMap.js:132:13)
    at HasteMap.js:103:28
    at tryCallOne (/home/rlai/react-projects/Todos/node_modules/react-native/node_modules/promise/lib/core.js:37:12)
    at /home/rlai/react-projects/Todos/node_modules/react-native/node_modules/promise/lib/core.js:123:15
    at flush (/home/rlai/react-projects/Todos/node_modules/react-native/node_modules/promise/node_modules/asap/raw.js:50:29)
    at doNTCallback0 (node.js:419:9)
    at process._tickCallback (node.js:348:13)

I had to start from a complete new project.

@adamterlson
Copy link
Contributor

Try upgrading to npm@3. Does it work then (after deleting node_modules and npm installing again)?

@jasonmerino
Copy link

I'm also running into a similar naming collision error when trying to upgrade to 0.18.1. Mine shows as follows:

[10:33:06 AM] <END>   Crawling File System (1352ms)
[10:33:06 AM] <START> Building in-memory fs for JavaScript
[10:33:06 AM] <END>   Building in-memory fs for JavaScript (335ms)
[10:33:06 AM] <START> Building in-memory fs for Assets
[10:33:06 AM] <END>   Building in-memory fs for Assets (310ms)
[10:33:06 AM] <START> Building Haste Map
[10:33:07 AM] <START> Building (deprecated) Asset Map
[10:33:07 AM] <END>   Building (deprecated) Asset Map (159ms)
Error building DependencyGraph:
 Error: Naming collision detected: /Users/jason.merino/Code/MyApp/node_modules/fbjs/flow/include/warning.js collides with /Users/jason.merino/Code/MyApp/node_modules/fbemitter/node_modules/fbjs/lib/warning.js
    at HasteMap._updateHasteMap (HasteMap.js:132:13)
    at HasteMap.js:103:28
    at tryCallOne (/Users/jason.merino/Code/MyApp/node_modules/promise/lib/core.js:37:12)
    at /Users/jason.merino/Code/MyApp/node_modules/promise/lib/core.js:123:15
    at flush (/Users/jason.merino/Code/MyApp/node_modules/asap/raw.js:50:29)
    at nextTickCallbackWith0Args (node.js:452:9)
    at process._tickCallback (node.js:381:13)

I have done the following and it still shows up:

rm -rf node_modules
npm cache clean
npm i

Here's my current setup

npm 3.3.12
react native 0.18.1

@corbt corbt added the Packager label Jan 21, 2016
@corbt
Copy link
Contributor

corbt commented Jan 21, 2016

Ok yeah @jasonmerino probably the version of fbjs that "fbemitter" wants doesn't match the version that react-native requires, so even npm3 installs it twice. This is a problem we need to get solved.

@jasonmerino
Copy link

Thanks @corbt! Yeah, I was thinking that was odd that npm3 still had some nested dependencies, but a version mismatch makes sense.

@ferologics
Copy link

Same problem here on:
npm 3.3.12
react native 0.18.1

Error: Naming collision detected: /Users/master/Pomodoro/node_modules/reactfire/node_modules/react/lib/BeforeInputEventPlugin.js collides with /Users/master/Pomodoro/node_modules/react/lib/BeforeInputEventPlugin.js

After deleting the BeforeInputEventPlugin from "node_modules/reactfire/" dir I get

Error: Naming collision detected: /Users/master/Pomodoro/node_modules/reactfire/node_modules/react/lib/CSSCore.js collides with /Users/master/Pomodoro/node_modules/fbjs/lib/CSSCore.js

@ericraio
Copy link
Contributor

@fsp thanks! I was able to fix this by removing the fbjs directory. I hope there is a proper solution soon.

@danpe
Copy link

danpe commented Feb 1, 2016

Still having the same issue either using npm2 or npm3

@jasonmerino
Copy link

I'm getting a new error in my project after installing babel-preset-react-native and adding it to my .babelrc file. The odd thing is that it's complaining about a package.json file which, obviously, doesn't use the @providesModule comment.

Error building DependencyGraph:
 Error: Naming collision detected: /Users/jason.merino/Code/MyApp/node_modules/babel-preset-react-native/node_modules/react-transform-hmr/package.json collides with /Users/jason.merino/Code/MyApp/node_modules/react-native/node_modules/react-transform-hmr/package.json
    at HasteMap._updateHasteMap (HasteMap.js:132:13)
    at HasteMap.js:112:32
    at tryCallOne (/Users/jason.merino/Code/MyApp/node_modules/react-native/node_modules/promise/lib/core.js:37:12)
    at /Users/jason.merino/Code/MyApp/node_modules/react-native/node_modules/promise/lib/core.js:123:15
    at flush (/Users/jason.merino/Code/MyApp/node_modules/react-native/node_modules/promise/node_modules/asap/raw.js:50:29)
    at doNTCallback0 (node.js:417:9)
    at process._tickCallback (node.js:346:13)

@joshuapinter
Copy link
Contributor

Getting the same error over here as well. Looks like fbemitter and react-native are both including the same fbjs lib and this causes it to barf up.

Error: Naming collision detected: 
node_modules/fbemitter/node_modules/fbjs/lib/warning.js 
collides with 
node_modules/react-native/node_modules/fbjs/lib/warning.js

This seems.... avoidable.

I'm new to React and React Native (and npm actually), any ideas?

Thanks.

@jasonmerino
Copy link

@joshuapinter The consensus seems to be adding a postinstall script to your package.json file that removes all fbjs folders in node_modules that is not at the top level. Check this gist out for help on that.

This also assumes that you have installed fbjs as a dependency in your project.

@yelled3
Copy link
Contributor

yelled3 commented Feb 3, 2016

i'm using react-native v0.19.0 & npm3 and I still get the same error.
the only thing that worked for me was using the hack mentioned by @jasonmerino.

@rclai
Copy link
Contributor

rclai commented Feb 3, 2016

By the way, what's with 0.19.0? Last I checked it was an official release and all of a sudden it's back to 0.18.0?

@joshuapinter
Copy link
Contributor

@jasonmerino Thanks for the advice. I created the postinstall script and did a fresh npm install. Now I'm getting this:

Error: Naming collision detected: 
node_modules/fbjs/flow/include/toArray.js 
collides with 
node_modules/fbjs/lib/toArray.js

Any ideas?

Many Thanks!

@ericmasiello
Copy link

Does anyone know if downgrading to react-redux 3.1.2 and using react native 18 still works?

@rclai
Copy link
Contributor

rclai commented Feb 4, 2016

@ericmasiello, yes it works, I had to do that.

@atticoos
Copy link
Contributor

atticoos commented Feb 7, 2016

Having the same issue over in dancormier/react-native-swipeout#65

@arunabha
Copy link

@joshuapinter What worked for me (react native 0.19, npm 3.6.0) was to pin fbjs to 0.6.1 and ensuring that only the top level fbjs was present (following #5467)

npm uninstall fbjs
npm install fbjs@0.6.1
find . -name 'fbjs' -print (delete all fbjs directories except the one at the top level)

Hope this helps. I really love React Native, but upgrades are certainly not good for the hairline :-)

@joshuapinter
Copy link
Contributor

Voila!

Thanks @arunabha!

I see this with Rails and Bundler from time to time but I didn't expect it with only a few modules in the package.

@iTonyYo
Copy link

iTonyYo commented Feb 15, 2016

Check here to solve this issue. 👏👍😃

@daemonchen
Copy link
Contributor

@iTonyYo It doesn't work for me.

my npm version is 3.3.12; my react-native is 0.20.0.

I try rm -rf node_modules/ & rm -rf $TMPDIR/react-* & find . -name 'fbjs' -print | grep "\./node_modules/fbjs" -v | xargs rm -rf & even change all the fbjs dependencies to 0.7.2,
but it's still not work...

@Kureev
Copy link
Contributor

Kureev commented Feb 20, 2016

Run your packager with a --resetCache flag.

$ ./node_modules/react-native/packager/packager.sh start --resetCache

@license2e
Copy link

It isn't just fbjs that is throwing the error, its also react

Running npm dedupe got it past the "Naming collision detected" (along with @Kureev suggestion of --resetCache)

@yelled3
Copy link
Contributor

yelled3 commented Mar 2, 2016

@license2e can you please write a step by step solution? (& specify versions, etc...)

@jsierles
Copy link
Contributor

Thanks to everyone for the suggested fixes provided in this thread.

As of the upcoming 0.22 release, fbjs and react are consumed from npm, not vendored, so most of these issues should go away. Please give 0.22.0-rc4 a try!

To keep issues focused on current bugs, we're closing this issue.

Feel free to continue the discussion here for earlier versions, or reopen should this issue come back using 0.22.0. Thanks!

@rahulbhankar786
Copy link

getting same error.

Error building DependencyGraph:
Error: Naming collision detected: E:\react-native demo\demo-app-master\node_modules\react-native\node_modules\fbjs\lib\CSSCore.js collides with E:\react-native demo\demo-app-master\node_modules\react\node_modules\fbjs\lib\CSSCore.js
at HasteMap._updateHasteMap (E:/react-native demo/demo-app-master/node_modules/react-native/packager/react-packager/src/DependencyResolver/DependencyGraph/HasteMap.js:132:13)
at E:/react-native demo/demo-app-master/node_modules/react-native/packager/react-packager/src/DependencyResolver/DependencyGraph/HasteMap.js:103:28
at tryCallOne (E:\react-native demo\demo-app-master\node_modules\promise\lib\core.js:37:12)
at E:\react-native demo\demo-app-master\node_modules\promise\lib\core.js:123:15
at flush (E:\react-native demo\demo-app-master\node_modules\asap\raw.js:50:29)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)

@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests