2017-09-23 27 views
0

我不知道为什么这发生在我没有安装任何新的东西时,我的反应原生项目。我试过清除所有缓存,包括豆荚。删除node_modules,再次安装npm。我也尝试做反应本地链接。本机模块不能为空。 IOS

screenshot of the error on simulator

在Xcode中日志:

2017-09-23 14:22:13.600 [info][tid:main][RCTCxxBridge.mm:188] Initializing 
<RCTCxxBridge: 0x6080001b6b20> (parent: <RCTBridge: 0x6080002a2ca0>, executor: 
(null)) 
2017-09-23 14:22:13.651 [warn][tid:main][RCTBridge.m:114] Class RCTCxxModule 
was not exported. Did you forget to use RCT_EXPORT_MODULE()? 
2017-09-23 14:22:13.675 [info][tid:main][RCTRootView.m:302] Running 
application test ({ 
    initialProps =  { 
    }; 
    rootTag = 1; 
}) 
2017-09-23 14:22:14.000 [info][tid:com.facebook.react.JavaScript] 'DISPATCH', undefined 
2017-09-23 14:22:14.008 [warn][tid:com.facebook.react.JavaScript] Warning: PropTypes has been moved to a separate package. Accessing React.PropTypes is no longer supported and will be removed completely in React 16. Use the prop-types 
package on npm instead. (-) 
2017-09-23 14:22:14.026694+0800 test[34066:66467192] [] nw_connection_get_connected_socket_block_invoke 5 Connection has no connected handler 
2017-09-23 14:22:14.040 [warn][tid:com.facebook.react.JavaScript] Warning: React.createClass is no longer supported. Use a plain JavaScript class instead. If you're not yet ready to migrate, create-react-class is available on npm as a drop-in replacement. (-) 
2017-09-23 14:22:14.052 [info][tid:com.facebook.react.JavaScript] Running application "test" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF 
2017-09-23 14:22:14.069 [error][tid:com.facebook.react.JavaScript] Native module cannot be null. 
2017-09-23 14:22:14.073 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Native module cannot be null. 
2017-09-23 14:22:14.077 [error][tid:com.facebook.react.JavaScript] undefined is not an object (evaluating 'require(324       ).default') 

Podfile:

source 'https://github.com/CocoaPods/Specs.git' 

platform :ios, '8.0' 

target 'test' do 

    pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga/Yoga.podspec' 
    pod 'React', path: '../node_modules/react-native', :subspecs => [ 
    'Core', 
    'RCTActionSheet', 
    'RCTAnimation', 
    'RCTGeolocation', 
    'RCTImage', 
    'RCTLinkingIOS', 
    'RCTNetwork', 
    'RCTSettings', 
    'RCTText', 
    'RCTVibration', 
    'RCTWebSocket', 
    'BatchedBridge' 
    ] 

    pod 'GoogleMaps' # <~~ remove this line if you do not want to support  GoogleMaps on iOS 
    #pod 'react-native-maps', path: '../node_modules/react-native-maps' 

end 
+0

你可以尝试删除“build”文件夹并再次运行调试吗?确保你已经得到了副本!以防万一。但也许模块不见了。检查depencies文件藏汉 – blacksun

+0

我努力了,我做了所有这些: 守望手表德尔 - 所有 室射频node_modules 室射频$ TMPDIR/react- * 室射频$ TMPDIR/NPM-* 室射频IOS /荚荚 缓存清理--all 荚回购更新&&吊舱安装 NPM安装 ./android/gradlew干净-p ./android/ 室射频IOS /建 NPM启动 - --reset缓存 – jomaint

回答

0

其中一个原因此错误消息可能会使用了不正确安装一个lib 。我最后一次遇到这个问题是因为我忘记从我的组件中删除一个不再使用的库(没有npm install/react-native链接它)。 如果您没有安装任何lib,请检查您的组件。您可以尝试创建一个新项目,使用相同的package.json/podfile,逐渐添加您的js文件并检查是否显示错误。

希望它有帮助。

+0

更新:我创建了一个像你说的新项目,并复制了js文件package.json和podfile。似乎修复这个错误。 – jomaint