when I execute ./packager/packager.sh, I see the error below!
Error building DepdendencyGraph:
Error: Naming collision detected: /Users/guo/Desktop/react-native/node_modules/react-tools/src/shared/vendor/core/dom/isTextNode.js collides with /Users/guo/Desktop/react-native/AwesomeProject/node_modules/react-native/node_modules/react-tools/src/shared/vendor/core/dom/isTextNode.js
at HasteMap._updateHasteMap (/Users/guo/Desktop/react-native/packager/react-packager/src/DependencyResolver/DependencyGraph/HasteMap.js:123:13)
at /Users/guo/Desktop/react-native/packager/react-packager/src/DependencyResolver/DependencyGraph/HasteMap.js:95:28
at tryCallOne (/Users/guo/Desktop/react-native/node_modules/promise/lib/core.js:37:12)
at /Users/guo/Desktop/react-native/node_modules/promise/lib/core.js:103:15
at flush (/Users/guo/Desktop/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)
@foghina @martinbigio I got the same error.
Some observations:
1) react-native init projectName and then npm start. npm start if broken however react-native start works.
err:
sh: node_modules/react-native/packager/packager.sh: No such file or directory
2) name collision detected error after doing react-native start.
I took master branch for generating the new project(changed the cli for this).
I'm getting similar error but its erroring out on react-tools, any ideas?
Error building DepdendencyGraph:
Error: Naming collision detected: /Users/corysmith/Apps/indieshuffle/node_modules/react-native/node_modules/react-tools/package.json collides with /Users/corysmith/Apps/indieshuffle/node_modules/react-native/packager/package.json
at HasteMap._updateHasteMap (/Users/corysmith/Apps/indieshuffle/node_modules/react-native/packager/react-packager/src/DependencyResolver/DependencyGraph/HasteMap.js:127:13)
at /Users/corysmith/Apps/indieshuffle/node_modules/react-native/packager/react-packager/src/DependencyResolver/DependencyGraph/HasteMap.js:104:32
at tryCallOne (/Users/corysmith/Apps/indieshuffle/node_modules/react-native/node_modules/promise/lib/core.js:37:12)
at /Users/corysmith/Apps/indieshuffle/node_modules/react-native/node_modules/promise/lib/core.js:103:15
at flush (/Users/corysmith/Apps/indieshuffle/node_modules/react-native/node_modules/promise/node_modules/asap/raw.js:50:29)
at doNTCallback0 (node.js:407:9)
at process._tickCallback (node.js:336:13)
I'm getting similar error too after adding react-native-router
Error building DepdendencyGraph:
Error: Naming collision detected: /Users/andrej/projects/test/testProject/node_modules/react-native-router/node_modules/react-native/Libraries/Promise.js collides with /Users/andrej/projects/test/testProject/node_modules/react-native/Libraries/Promise.js
at HasteMap._updateHasteMap (/Users/andrej/projects/test/testProject/node_modules/react-native/packager/react-packager/src/DependencyResolver/DependencyGraph/HasteMap.js:123:13)
at /Users/andrej/projects/test/testProject/node_modules/react-native/packager/react-packager/src/DependencyResolver/DependencyGraph/HasteMap.js:95:28
at tryCallOne (/Users/andrej/projects/test/testProject/node_modules/react-native/node_modules/promise/lib/core.js:37:12)
at /Users/andrej/projects/test/testProject/node_modules/react-native/node_modules/promise/lib/core.js:103:15
at flush (/Users/andrej/projects/test/testProject/node_modules/react-native/node_modules/promise/node_modules/asap/raw.js:50:29)
at doNTCallback0 (node.js:407:9)
at process._tickCallback (node.js:336:13)
If your are stuck up here
So have a solution for this but not forever
you can delete you react-native folder from node_module/react-native-router/node_module/react-native
and you can use react-native from node_module/react-native
I fixed a similar issue to the duplicated module one on dee96fbedcd600e8819019005ae75ffbee2246f0. In regards the packager.sh, that one should have been fixed on 32aeeea3135fbb504b1481c0e7cbad1ddf1ae057.
Please reopen if any of this still repro :)
cc @mkonicek in case you've seen the naming colision mentioned on the task
This Promise issue looks legimit, sorry for closing. @mkonicek we don't have a strategy for dealing with this inside the packager, it just doesn't support having the same haste module defined twice. Fortunately, the new CLI brings the getBlacklistedRE function to the user on rn-cli.config.js so people should be able to blacklist the ones they want to get rid. Not sure if we can do anything in the mean time.
@martinbigio I have an idea for how to handle duplicate Haste modules by scoping them. I don't have the bandwidth to build it myself but will describe my vision for it in a new issue.
@ide, I think part of this will be solved by the issue we were just chatting about, which is that haste modules outside of react-native, react-tools, and currently, due to AsyncStorage, parse, shouldn't be used at all. Duplicate Haste module scoping would be cool, but I think fixing this other issue (which I plan to do ASAP) will solve most cases.
@skevy so just to be clear -- you want to fix deep dependencies so that we don't run javascript for Node on a platform.. that's not Node?
Wait, what? I don't think I said that. I'm confused by your response.
All I was saying was that the issue described here would be resolved by @providesModule not being used by the packager for packages outside of the FB ecosystem.
Oh i see. I thought you were referring to honoring the "browser" entry in the JSON.
No no...we should have the 'react-native' directive.
What things should I know before adding to the blacklist file? as it is Im getting
Error building DepdendencyGraph:
Error: Naming collision detected:
.../main_application/node_modules/react-native/node_modules/react-tools/src/shared/vendor/core/warning.js collides with .../main_application/node_modules/react-native/node_modules/react-tools/docs/js/react.js
at HasteMap._updateHasteMap (.../main_application/node_modules/react-native/packager/react-packager/src/DependencyResolver/DependencyGraph/HasteMap.js:123:13)
at .../main_application/node_modules/react-native/packager/react-packager/src/DependencyResolver/DependencyGraph/HasteMap.js:95:28
at tryCallOne (.../main_application/node_modules/react-native/node_modules/promise/lib/core.js:37:12)
at .../main_application/node_modules/react-native/node_modules/promise/lib/core.js:103:15
at flush (.../main_application/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)
when I add warning.js and also one other file to the blacklist the packager starts but I run into issues once the application starts
@mangogogos i got the same situation,
Error building DepdendencyGraph:
Error: Naming collision detected: E:\Andriod\AwesomeProject\node_modules\react-native\node_modules\react-tools\src\shared\vendor\core\warning.js collides with E:\Andriod\AwesomeProject\node_modules\react-native\node_modules\react-tools\docs\js\react.js
at HasteMap._updateHasteMap (E:/Andriod/AwesomeProject/node_modules/react-native/packager/react-packager/src/DependencyResolver/DependencyGraph/HasteMap.js:123:13)
at E:/Andriod/AwesomeProject/node_modules/react-native/packager/react-packager/src/DependencyResolver/DependencyGraph/HasteMap.js:95:28
at tryCallOne (E:\Andriod\AwesomeProject\node_modules\react-native\node_modules\promise\lib\core.js:37:12)
at E:\Andriod\AwesomeProject\node_modules\react-native\node_modules\promise\lib\core.js:103:15
at flush (E:\Andriod\AwesomeProject\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)
PS E:\Andriod\AwesomeProject> react-native -v
0.1.7
PS E:\Andriod\AwesomeProject>
in my node_modules,there is only react-native, no more others. so who can help?
I have the same issue
Same problem here. I found a workaround: npm prune && npm i
It happened to me when I changed some dependencies in my project. Running ./node_modules/react-native/packager/packager.sh --resetCache fixed the dependencies issue.
Is there a way to exclude a folder from the packaging?
@jpapillon solution don't works for me
Removing global react-native-cli package worked for me:
npm uninstall -g react-native-cli
I'm trying to put a fairly complex react application into a webview in react native (to buy myself a little bit of time to do the "Real" port to RN. But I'm running into this issue. I've tried everything I can think of, but it seems that my compiled app (in dist/assets/main.js is legitimately colliding with the version of invariant that react-tools is trying to pull in.
Am I just totally stuck here until someone figures out how to namespace/scope the Haste modules?
[9:18:47 AM] <START> Building Haste Map
Error building DepdendencyGraph:
Error: Naming collision detected: /Users/litch/code/Wallet/dist/assets/main.js collides with /Users/litch/code/Wallet/node_modules/react-tools/src/shared/vendor/core/invariant.js
at HasteMap._updateHasteMap (/Users/litch/code/Wallet/node_modules/react-native/packager/react-packager/src/DependencyResolver/DependencyGraph/HasteMap.js:123:13)
at /Users/litch/code/Wallet/node_modules/react-native/packager/react-packager/src/DependencyResolver/DependencyGraph/HasteMap.js:95:28
at tryCallOne (/Users/litch/code/Wallet/node_modules/promise/lib/core.js:37:12)
at /Users/litch/code/Wallet/node_modules/promise/lib/core.js:103:15
at flush (/Users/litch/code/Wallet/node_modules/asap/raw.js:50:29)
at doNTCallback0 (node.js:428:9)
at process._tickCallback (node.js:357:13)
Process terminated. Press <enter> to close the window
The packager has a way to configure a blacklist (grep around for the details), which would let you exclude main.js from the JS bundle since RN doesn't need it anyway.
Oh - ok. That is interesting, thank you.
None of the "solutions" work for me. Anyone have a way around this?
The same issue. Previous suggestions don't work for me
Error building DependencyGraph:
Error: Naming collision detected: /Users/native/node_modules/react-native-router/node_modules/react-native/packager/react-packager/src/DependencyResolver/haste/polyfills/String.prototype.es6.js collides with /Users/native/node_modules/react-native/packager/react-packager/src/Resolver/polyfills/String.prototype.es6.js
at HasteMap._updateHasteMap (HasteMap.js:123:13)
at HasteMap.js:94:28
at tryCallOne (/Users/native/node_modules/react-native/node_modules/promise/lib/core.js:37:12)
at /Users/native/node_modules/react-native/node_modules/promise/lib/core.js:123:15
at flush (/Users/native/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)
npm -v; node -v
3.3.12
v5.4.0
Error building DependencyGraph:
Error: Naming collision detected: /Users/vkhazin/Projects/Samples/ReactNative/package.json collides with /Users/vkhazin/Projects/Samples/ReactNative/node_modules/react-native/Libraries/ReactNative/ReactNative.js
at HasteMap._updateHasteMap (HasteMap.js:123:13)
at HasteMap.js:103:32
at tryCallOne (/Users/vkhazin/Projects/Samples/ReactNative/node_modules/promise/lib/core.js:37:12)
at /Users/vkhazin/Projects/Samples/ReactNative/node_modules/promise/lib/core.js:123:15
at flush (/Users/vkhazin/Projects/Samples/ReactNative/node_modules/asap/raw.js:50:29)
at nextTickCallbackWith0Args (node.js:456:9)
at process._tickCallback (node.js:385:13)
~
as @ide mentioned you can blacklist files/regexps on the packager. Take a look at packager/blacklist.js :)
thank you for your comment martinbigio!
Could you please elaborate a bit more as my experience with React.js is 6 hours old and with React Mobile 2 hours old?
@vkhazin absolutely, I'm glad you're giving React Native a try. My comment was for @yarax tough. There's something wrong on your setup. The steps posted on https://facebook.github.io/react-native/docs/getting-started.html should work. Could you give it a try? :)
Also, in general it's better to ask these type of questions on Stack Overflow: http://stackoverflow.com/questions/tagged/react-native
Hi Martin,
Thank you for your comments!
I did tried twice twice using node 4x and node 5x to make sure the issue is
not related to version of node.
In both cases created the project using the instructions mentioned:
https://facebook.github.io/react-native/docs/getting-started.html and in
both cases ended up with the same error.
On Tue, Jan 12, 2016 at 11:20 AM, MartÃn Bigio [email protected]
wrote:
Also, in general it's better to ask these type of questions on Stack
Overflow: http://stackoverflow.com/questions/tagged/react-native—
Reply to this email directly or view it on GitHub
https://github.com/facebook/react-native/issues/3558#issuecomment-170962404
.
Sincerely yours,
Vlad Khazin
Email: vlad.[email protected]
Skype: vladimir.khazin
Cell: 416-802-2771
Fax: 866-425-2660
I think the problem is related to the fact the project name is ReactNative. cc @mkonicek
Here is something to laugh about:
Repeat all of the above steps with 'react-native init AwesomeProject' and it runs!
I had a similar issue when downgrading from 21 to 18, and uninstalled the react peer dependency and collision error never occurred again.
npm uninstall react --save
Failed to build DependencyGraph: Naming collision detected: /Users/erwai/Documents/app/MyApp/node_modules/react/node_modules/fbjs/lib/warning.js collides with /Users/erwai/Documents/app/MyApp/node_modules/fbjs/lib/warning.js
Error: Naming collision detected: /Users/erwai/Documents/app/MyApp/node_modules/react/node_modules/fbjs/lib/warning.js collides with /Users/erwai/Documents/app/MyApp/node_modules/fbjs/lib/warning.js
at HasteMap._updateHasteMap (HasteMap.js:132:13)
at HasteMap.js:103:28
at tryCallOne (/Users/erwai/Documents/app/MyApp/node_modules/promise/lib/core.js:37:12)
at /Users/erwai/Documents/app/MyApp/node_modules/promise/lib/core.js:123:15
at flush (/Users/erwai/Documents/app/MyApp/node_modules/asap/raw.js:50:29)
at _combinedTickCallback (node.js:376:9)
at process._tickCallback (node.js:407:11)
npm ERR! Darwin 15.2.0
npm ERR! argv "/Users/erwai/.nvm/versions/node/v5.9.1/bin/node" "/Users/erwai/.nvm/versions/node/v5.9.1/bin/npm" "start"
npm ERR! node v5.9.1
npm ERR! npm v3.8.3
I tried all methods suggested above and none of them works...
I updated my Node & npm versions to the latest versions but it still not working.
Do yourselves a favor:
If you had/have a problem resolving modules:
"start": "node node_modules/react-native/local-cli/cli.js start --root ../path-to-root/ -- --reset-cache"'use strict';
const path = require('path');
module.exports = {
getProjectRoots() {
return this._getRoots();
},
getAssetRoots() {
return this._getRoots();
},
_getRoots() {
// match on either path separator
if (__dirname.match(/node_modules[\/\\]react-native[\/\\]packager$/)) {
// packager is running from node_modules of another project
return [path.resolve(__dirname, '../../..')];
} else if (__dirname.match(/Pods\/React\/packager$/)) {
// packager is running from node_modules of another project
return [path.resolve(__dirname, '../../..')];
} else {
return [
path.resolve(__dirname, '../'),
path.resolve(__dirname, '.'),
path.resolve(__dirname, '../path-to-root/')
];
}
},
};
Starting with the --reset-cache flag is fairly key. I had it in at one point when attempting to resolve modules then took it out thinking I didn't need it anymore. Once the project blew up for whatever reason the Name collision error popped up. The only thing I actually changed that made it _work_ was re-inputting the --reset-cache flag in the start script after deleting modules, watchmen, and even npm cache cleaning.
Credit goes to @johnknaack for finding the rn-cli-config.js option found in react-native/local-cli/detail.config.js
It works for me. @hyphenbash Remove react.
Thanks @hyphenbash Also resolved this problem on Ubuntu Linux 15.10 by removing react depency. (I had downgraded from react native 0.24.1 to 0.20.0)
All, use react-native version 0.26.0. That'll solve your problem.
@yarax Apparently having NPM version > 3.0 was the fix for me when i had the exact same issue. Hope this helps if you are still looking.
intenta con este metodo:
I had this problem because I had a node_modules and a node_modules_bk folder.
It worked after deleting the second one.
I was getting errors like
Failed to build DependencyGraph: @providesModule naming collision:
Failed to build DependencyGraph: @providesModule naming collision:
Duplicate module name: accepts
Duplicate module name: accepts
I solved it by deleting npm's cache .npm and rerunning packager with --reset-cache
rm -rf ~/.npm
For me the naming collision error was actually caused by using --reset-cache. Running packager without resetting the cache fixes it.
If anyone's using react-native-router-flux and ending up here for help check:
https://github.com/aksonov/react-native-router-flux/issues/1803
Most helpful comment
If your are stuck up here
So have a solution for this but not forever
you can delete you react-native folder from node_module/react-native-router/node_module/react-native
and you can use react-native from node_module/react-native