react-native [iOS] RCTAssert RCTFormatError 165 ReferenceError:找不到变量:typeAnnotation
Posted
技术标签:
【中文标题】react-native [iOS] RCTAssert RCTFormatError 165 ReferenceError:找不到变量:typeAnnotation【英文标题】:react-native [iOS] RCTAssert RCTFormatError 165 ReferenceError: Can't find variable: typeAnnotation 【发布时间】:2021-01-20 13:38:31 【问题描述】:[ios] 应用程序在我直接运行时在模拟器或设备上运行良好,但是当我生成存档时它崩溃了。 在 Crashlytics 的帮助下,我在这里找到了问题
Fatal Exception: RCTFatalException: Unhandled JS Exception: ReferenceError: Can't find variable: typeAnnotation
Unhandled JS Exception: ReferenceError: Can't find variable: typeAnnotation, stack: <unknown>@1383:17088 v@2:1473 <unknown>@1382:425 v@2:1473 <unknown>@1381:339 v@2:1473 <unknown>@1374:6338 v@2:1473 <unknown>@1373:303 v@2:1473 <unknown>@650:7881 v@2:1473 <unknown>@437:237 v@2:1473 <unknown>@408:255 v@2:1473 <unknown>@6:57 v@2:1473 d@2:875 global code@1711:3
RCTAssert.m - Line 165
RCTFormatError + 165
React Native 版本:
System:
OS: macOS 11.0.1
CPU: (4) x64 Intel(R) Core(TM) i5-5250U CPU @ 1.60GHz
Memory: 21.23 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.13.0 - ~/.nvm/versions/node/v12.13.0/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 6.12.0 - ~/.nvm/versions/node/v12.13.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.0 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.2, DriverKit 20.0, macOS 11.0, tvOS 14.2, watchOS 7.1
android SDK:
API Levels: 23, 26, 28, 29, 30
Build Tools: 28.0.3, 29.0.2, 30.0.2
System Images: android-29 | Google Play Intel x86 Atom, android-30 | Google APIs Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 4.1 AI-201.8743.12.41.6953283
Xcode: 12.2/12B45b - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_275 - /usr/bin/javac
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: 0.63.3 => 0.63.3
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
【问题讨论】:
我们如何验证捆绑包是否在存档中绑定,我认为这可能是问题 【参考方案1】:通过添加来修复
import 'react-native-gesture-handler';
到 index.js
其次,我从 babel 中删除了一个导致崩溃的自动导入的东西。
删除了这个import cloneDeep from '@babel/types';
从 babel 自动导入是主要的崩溃。
【讨论】:
以上是关于react-native [iOS] RCTAssert RCTFormatError 165 ReferenceError:找不到变量:typeAnnotation的主要内容,如果未能解决你的问题,请参考以下文章
React-native:如何从 Windows 构建 ios
React-Native入门指导之iOS篇 —— 一准备工作
react-native android/ios 手动/自动 修改版本号