ReactNative - 未处理的JS异常:SyntaxError [英] ReactNative - Unhandled JS Exception: SyntaxError
问题描述
当我试图在iOS 8上启动我的RN应用程序时,我得到了这个奇怪的错误:未处理的JS异常:SyntaxError
这就是全部,而不是更多信息更多。
是否有任何人偶然发现了这个问题?
关于iOs 9+应用程序运行正常。
When Im trying to launch my RN app on iOS 8 I get this weird error: Unhandled JS Exception: SyntaxError
And thats all, not any more info more.
Does any1 stumbled across that issue?
On iOs 9+ application runs ok tho.
xCode版本:8.1。来自xCode的日志:
2016-12-07 16:33:57.073 [info] [tid:main] [RCTBatchedBridge.m:73]初始化< RCTBatchedBridge:0x7fc36c72ae80> (父:< RCTBridge:0x7fc36c060920>,执行人:RCTJSCExecutor)
2016-12-07 16:34:29.369 [warn] [tid:com.facebook.react.JavaScript] [RCTBatchedBridge.m:509]失败执行源代码:Unhandled JS异常:SyntaxError
2016-12-07 16:34:29.369 [致命] [tid:main]未处理的JS异常:SyntaxError
xCode version: 8.1. Logs from xCode:
2016-12-07 16:33:57.073 [info][tid:main][RCTBatchedBridge.m:73] Initializing <RCTBatchedBridge: 0x7fc36c72ae80> (parent: <RCTBridge: 0x7fc36c060920>, executor: RCTJSCExecutor)
2016-12-07 16:34:29.369 [warn][tid:com.facebook.react.JavaScript][RCTBatchedBridge.m:509] Failed to execute source code: Unhandled JS Exception: SyntaxError
2016-12-07 16:34:29.369 [fatal][tid:main] Unhandled JS Exception: SyntaxError
我的package.json:
{
name:...,
version: 0.0.1,
private:true,
scripts:{
start:node node_modules / react-native / local-cli / cli.js start ,
test:jest
},
依赖:{
fbjs:^ 0.8.6,
时刻: ^ 2.16.0,
反应:15.3.2,
react-native:^ 0.37.0,
react-native-chart: ^ 1.0.8-beta,
react-native-gifted-chat:0.0.10,
react-native-image-picker:^ 0.23.0,
react-native-image-progress:^ 0.6.0,
react-native-locale:0.0.11,
react-native-material-包: ^ 0.3.3,
react-native-message-bar:^ 1.6.0,
react-native-modal-datetime-picker:^ 3.0.0 ,
react-native-modal-picker:0.0.16,
react-native-router-flux:^ 3.37.0,
react-native -timer:^ 1.1.2,
shortid:^ 2.2.6
},
jest:{
预设:开玩笑-react-native
},
devDependencies:{
babel-jest:17.0.0,
babel-preset-react-native: 1.9.0,
jest:17.0.1,
jest-react-native:17.0.1,
react-test-renderer: 15.3.2,
whatwg-fetch:1.0.0
}
}
My package.json:
{
"name": "...",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"fbjs": "^0.8.6",
"moment": "^2.16.0",
"react": "15.3.2",
"react-native": "^0.37.0",
"react-native-chart": "^1.0.8-beta",
"react-native-gifted-chat": "0.0.10",
"react-native-image-picker": "^0.23.0",
"react-native-image-progress": "^0.6.0",
"react-native-locale": "0.0.11",
"react-native-material-kit": "^0.3.3",
"react-native-message-bar": "^1.6.0",
"react-native-modal-datetime-picker": "^3.0.0",
"react-native-modal-picker": "0.0.16",
"react-native-router-flux": "^3.37.0",
"react-native-timer": "^1.1.2",
"shortid": "^2.2.6"
},
"jest": {
"preset": "jest-react-native"
},
"devDependencies": {
"babel-jest": "17.0.0",
"babel-preset-react-native": "1.9.0",
"jest": "17.0.1",
"jest-react-native": "17.0.1",
"react-test-renderer": "15.3.2",
"whatwg-fetch": "1.0.0"
}
}
Node,npm和react-native verisons:
adamt @ Dev-2~ / D / G / myApp> npm -v
4.0.2
adamt @ Dev-2~ / D / G / myApp>节点-v
v4.4.4
adamt @ Dev-2~ / D / G / myApp> react-native -v
react-native-cli:1.2.0
react-native:0.37.0
Node, npm and react-native verisons:
adamt@Dev-2 ~/D/G/myApp> npm -v
4.0.2
adamt@Dev-2 ~/D/G/myApp> node -v
v4.4.4
adamt@Dev-2 ~/D/G/myApp> react-native -v
react-native-cli: 1.2.0
react-native: 0.37.0
对此错误发生的任何帮助都会受到欢迎!
Any help to why this error occurs would be much welcomed!
推荐答案
React Native版本0.39存在问题。
There is an issue React Native version 0.39.
您需要在node_modeles / react-native / Libraries / Core / InitializeCore.js中的第30行注释掉'use strict'; :
You need to comment out 'use strict'; in line 30 in node_modeles/react-native/Libraries/Core/InitializeCore.js:
// 'use strict'; Fix to RN 0.39 - https://github.com/facebook/react-native/issues/11389
或者,您可以返回React Native版本0.38。
Alternatively, you can go back to React Native version 0.38.
这篇关于ReactNative - 未处理的JS异常:SyntaxError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!