当我没有安装任何新内容时,我不确定为什么这会发生在我的反应本机项目中。我已经尝试清除所有缓存,包括pods。删除node_modules,再次安装npm。我也尝试做反应原生链接。
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 :(得分:0)
此错误消息的原因之一是您可能正在使用未正确安装的lib。我最后一次遇到这个问题是因为我忘了从我的组件中删除一个我不再使用的lib了(避免安装/ react-native链接它)。 如果您没有安装任何库,请仔细检查您的组件。您可以尝试创建一个新项目,使用相同的package.json / podfile,逐步添加js文件并检查是否出现错误。
希望它有所帮助。