2016-10-04 136 views
1

我已經升級了反應和反應原生依賴關係。當我嘗試在真實設備上構建並運行反應本機應用程序時,我會在啓動後在xcode和app上凍結一個白色屏幕中的跟蹤堆棧。JSON解析錯誤:意外標識符「RCTWebSocketModule」

2016-10-04 12:33:37.501 [info][tid:main][RCTBatchedBridge.m:74] Initializing <RCTBatchedBridge: 0x16575a10> (parent: <RCTBridge: 0x1658e200>, executor: RCTJSCExecutor) 
2016-10-04 12:33:37.507136 ReactApp[237:7244] Initializing <RCTBatchedBridge: 0x16575a10> (parent: <RCTBridge: 0x1658e200>, executor: RCTJSCExecutor) 
2016-10-04 12:33:37.695956 ReactApp[237:7292] [] __nw_connection_get_connected_socket_block_invoke 1 Connection has no connected handler 
2016-10-04 12:33:37.780 [info][tid:main][RCTBatchedBridge.m:74] Initializing <RCTBatchedBridge: 0x16681ec0> (parent: <RCTBridge: 0x1658e200>, executor: RCTWebSocketExecutor) 
2016-10-04 12:33:37.780715 ReactApp[237:7244] Initializing <RCTBatchedBridge: 0x16681ec0> (parent: <RCTBridge: 0x1658e200>, executor: RCTWebSocketExecutor) 
2016-10-04 12:33:37.865 [warn][tid:com.facebook.react.RCTBridgeQueue][RCTModuleData.mm:287] Required dispatch_sync to load constants for RCTUIManager. This may lead to deadlocks 
2016-10-04 12:33:37.866815 ReactApp[237:7292] Required dispatch_sync to load constants for RCTUIManager. This may lead to deadlocks 
2016-10-04 12:33:38.274 [error][tid:com.facebook.react.JavaScript] JSON Parse error: Unexpected identifier "RCTWebSocketModule" 
2016-10-04 12:33:38.274231 ReactApp[237:7303] JSON Parse error: Unexpected identifier "RCTWebSocketModule" 
2016-10-04 12:33:38.281 [info][tid:com.facebook.react.JavaScript] 'Failed to print error: ', 'JSON Parse error: Unexpected identifier "RCTSourceCode"' 
2016-10-04 12:33:38.281396 ReactApp[237:7303] 'Failed to print error: ', 'JSON Parse error: Unexpected identifier "RCTSourceCode"' 
2016-10-04 12:33:38.286 [error][tid:com.facebook.react.JavaScript] Requiring module "185", which threw an exception. 
2016-10-04 12:33:38.286470 ReactApp[237:7303] Requiring module "185", which threw an exception. 
2016-10-04 12:33:38.287 [info][tid:com.facebook.react.JavaScript] 'Failed to print error: ', 'Requiring module "191", which threw an exception.' 
2016-10-04 12:33:38.286985 ReactApp[237:7303] 'Failed to print error: ', 'Requiring module "191", which threw an exception.' 

當我運行了Android工作室同一個項目,我獲得以下蹤跡:

E/ReactNativeJS: JSON Parse error: Unexpected identifier "UIManager" 
I/ReactNativeJS: 'Failed to print error: ', 'JSON Parse error: Unexpected identifier "SourceCode"' 
W/unknown:React: Packager connection already open, nooping. 
E/ReactNativeJS: Module AppRegistry is not a registered callable module. 
E/ReactNativeJS: Requiring module "173", which threw an exception. 
I/ReactNativeJS: 'Failed to print error: ', 'Requiring module "173", which threw an exception.' 
I/ReactNativeJS: 'Failed to print error: ', 'JSON Parse error: Unexpected identifier "ExceptionsManager"' 

的package.json

{ 
    "dependencies": { 
    "react": "15.3.2", 
    "react-dom": "15.3.2", 
    "react-native": "^0.34.1", 
    "react-native-animatable": "0.6.1", 
    "react-native-collapsible": "0.7.0", 
    "react-native-drawer": "2.2.6", 
    "react-native-htmlview": "^0.5.0", 
    "react-native-push-notification": "^2.1.1", 
    "react-native-viewpager": "0.2.11", 
    "react-redux": "4.4.5", 
    "redux": "3.5.2", 
    "redux-thunk": "2.1.0" 
    } 
} 

回答

0

中的package.json不是的Valide。這裏從JSON驗證器的響應:

Error: Parse error on line 1: "dependencies": { "react": "1 --------------^ Expecting 'EOF', '}', ',', ']', got ':'

它必須看起來像這樣:

{ "dependencies": { "react": "15.3.2", "react-dom": "15.3.2", "react-native": "^0.34.1", "react-native-animatable": "0.6.1", "react-native-collapsible": "0.7.0", "react-native-drawer": "2.2.6", "react-native-htmlview": "^0.5.0", "react-native-push-notification": "^2.1.1", "react-native-viewpager": "0.2.11", "react-redux": "4.4.5", "redux": "3.5.2", "redux-thunk": "2.1.0" } }

+0

我已經添加了Package.json的一個依賴片段。這不是錯誤背後的原因。我在Package.json中有一個有效的json –

1

我遇到了今晚。這對我來說是一個緩存問題。重新啓動React Native Packager。

0

與現有應用程序集成時,我遇到同樣的問題。我解決了它。我在package.json中的「反應原生」版本代碼與Android應用程序不一樣。我用npm來安裝相同的版本。

相關問題