在真实设备崩溃上实现本机构建(emul working)

时间:2018-03-20 10:54:43

标签: react-native react-native-android react-native-ios

有人可以就我在这里做错了什么提出建议吗?

通过XCode (9.2)模拟器启动应用程序时,应用程序运行正常,在真实设备(iOS 11.2.6)上构建应用程序时,它会进一步引发错误: 尝试了这里描述的步骤:https://github.com/facebook/react-native/issues/4831

2018-03-20 12:05:22.400152+0500 qatar[1134:528934] *** Terminating app due to uncaught 
exception 'RCTFatalException: Unhandled JS Exception: 
TypeError: babelHelpers.objectDestructuringEmpty is not a function. 
(In 'babelHelpers.objectDestructuringEmpty(e)', 
'babelHelpers.objectDestructuringEmpty' is undefined)

This error is located at:
in Unknown
in t
in Connect(t)
in RCTView
in t
in RCTView
in RCTView
in RCTView
in t
in t
in t
in Connect(t)
in t
in RCTView
in n
in t
in n
in RCTView
in RCTView
in t
in RCTView
in e
in r
in Unknown
in n
in n
in t
in t
in withCachedChildNavigation(t)
in Unknown
in n
in RCTView
in n
in RCTView
in t
in t
in Unknown
in n
in n
in RCTView
in t
in Styled(t)
in n
in Unknown
in t
in Translate(Component)
in t
in RCTView
in RCTView
in t', reason: 'Unhandled JS Exception: TypeError: babelHelpers.objectDestructuringEmpty is..., stack:
default@738:198
<unknown>@46:29910
q@46:47194
ee@46:47795
ne@46:48869
le@46:51343
enqueueSetState@46:25514
setState@53:915
dispatch@857:822
<unknown>@855:668
b@23:628
callTimers@23:2773
value@18:3078
<unknown>@18:812
value@18:2507
value@18:784

Android给出了类似的错误:

Android error

2 个答案:

答案 0 :(得分:0)

你创建了一个bundle.js文件吗? 试试这个:

react-native bundle --entry-file='index.js' --bundle-output='./ios/AppName/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'

您能否提供有关.babelrc文件的更多信息?

答案 1 :(得分:0)

我在安装babel helper插件时得到了这个解决方案。

Package.json:
"devDependencies": {
"babel-cli": "6.26.0",
"babel-plugin-external-helpers": "^6.22.0",
....
}

babelrc:
{
"presets": ["react-native", "flow"],
"plugins": [
"external-helpers",
...
]
}

参考安装此插件: https://www.npmjs.com/package/babel-plugin-external-helpers

相关问题