0

The naming collision occurs, when the packager is trying to import the react-native-maps module during execution of react-native run-ios. I am using npm 3.10.3.

The error inside packager points to duplicate declaration of a module:

Failed to build DependencyGraph: @providesModule naming collision:
  Duplicate module name: String.prototype.es6
  Paths: /Users/Developer/ReactProject/node_modules/react-native/packager/react-packager/src/Resolver/polyfills/String.prototype.es6.js collides with /Users/Developer/ReactProject/ios/Pods/React/packager/react-packager/src/DependencyResolver/polyfills/String.prototype.es6.js

This error is caused by a @providesModule declaration with the same name across two different files.
Error: @providesModule naming collision:
  Duplicate module name: String.prototype.es6
  Paths: /Users/Developer/ReactProject/node_modules/react-native/packager/react-packager/src/Resolver/polyfills/String.prototype.es6.js collides with /Users/Developer/ReactProject/ios/Pods/React/packager/react-packager/src/DependencyResolver/polyfills/String.prototype.es6.js

This error is caused by a @providesModule declaration with the same name across two different files.
    at HasteMap._updateHasteMap (/Users/Developer/ReactProject/node_modules/react-native/packager/react-packager/src/node-haste/DependencyGraph/HasteMap.js:155:13)
    at module.getName.then.name (/Users/Developer/ReactProject/node_modules/react-native/packager/react-packager/src/node-haste/DependencyGraph/HasteMap.js:115:31)

A possible misconfiguration in Cocoapods.

Podfile:

platform :ios, '9.0'
target 'ReactProject' do
    pod 'React', :path => '../node_modules/react-native', :subspecs => [
      'Core',
      'RCTText',
      'RCTWebSocket',
    ]
    pod 'react-native-maps', :path => '../node_modules/react-native-maps'
end

package.json:

{
  "name": "ReactProject",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start"
  },
  "dependencies": {
    "react": "15.3.1",
    "react-native": "0.33.0",
    "react-native-maps": "^0.8.2"
  }
}
Peter G.
  • 7,816
  • 20
  • 80
  • 154
  • are you using NPM 3.0+? You might have to manually delete the duplicate packages from node_modules. – BradByte Sep 13 '16 at 15:08
  • Yes, I'm using npm 3.10.3. I deleted the whole node_modules folder and ran `npm install` but I still ended up with same error. Didn't try removing individual packages though. – Peter G. Sep 14 '16 at 06:57
  • I've had similar issues with `fbjs`. I think it was an issue with the react-native packager. Try removing all but one. You can also attempt blacklisting the dupe packages, but it's more advanced (https://github.com/facebook/react-native/issues/7271) – BradByte Sep 14 '16 at 13:18
  • Removing files (`AIRMapMarker.m`) in the the `node_modules` gives me: `clang: error: no such file or directory: '/Users/Developer/ReactProject/node_modules/react-native-maps/ios/AirMaps/AIRMapMarker.m' clang: error: no input files` – Peter G. Sep 15 '16 at 10:08
  • You'll want to remove the whole directory of the package. I would find them in the `package/node_modules/bad_package`. So you might have some packages that are requiring the same dependencies. – BradByte Sep 15 '16 at 11:00
  • Here's a similar issue https://github.com/facebook/react-native/issues/5390#issuecomment-172679236 – BradByte Sep 15 '16 at 11:01

0 Answers0