2017-09-23 59 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