gpt4 book ai didi

ios - 新的 react-native 应用程序有 'TypeError: babelHelpers.typeof is not a function' [iOS]

转载 作者:IT王子 更新时间:2023-10-29 08:05:04 24 4
gpt4 key购买 nike

使用最新版本的 react-native 创建的新项目在运行(/调试)时抛出 javascript 错误。在模拟器上测试了这个。

[fatal][tid:main] TypeError: babelHelpers.typeof is not a function. (In 'babelHelpers.typeof(target)', 'babelHelpers.typeof' is undefined)

今天安装了 react-native 客户端并使用

创建了应用程序
react-native init AwesomeProject

应用版本:

react-native-cli: 0.1.10
react-native: 0.20.0
node version: v5.6.0

最佳答案

这是一条解释问题的评论:

https://github.com/facebook/react-native/issues/4844#issuecomment-204035720

总结:

Babel 预设 'stage-0''stage-3' 包含 'async-to-generator',这不是react-native 本身是必需的。

解决方案是使用非官方的 babel 预设 'react-native-stage-0'

示例:

npm install babel-preset-react-native-stage-0 --save-dev

.babelrc

{
"presets": ["react-native-stage-0"]
}

或者有装饰器支持

{
"presets": ["react-native-stage-0/decorator-support"]
}

清空缓存并重启

watchman watch-del-all

./node_modules/react-native/packager/packager.sh start --reset-cache

关于ios - 新的 react-native 应用程序有 'TypeError: babelHelpers.typeof is not a function' [iOS],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35563025/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com