命名冲突内部反应原生包装器

时间:2016-09-13 14:59:49

标签: reactjs npm react-native cocoapods podfile

当打包程序在执行react-native-maps期间尝试导入react-native run-ios模块时,会发生命名冲突。我使用的是npm 3.10.3。

packager中的错误指向模块的重复声明:

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)

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"
  }
}

0 个答案:

没有答案