![](/img/trans.png)
[英]Debugging why react-native release build crushes and debug one works fine
[英]React Native release build crash issue, but on debug it is working fine
我在 iOS 上面臨發布構建崩潰問題並收到以下錯誤:
[error][tid:com.facebook.react.JavaScript] ReferenceError: Can't find variable: typeAnnotation
2020-12-31 01:16:15.086 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: ReferenceError: Can't find variable: typeAnnotation
2020-12-31 01:16:15.125896+0530 EPG[11841:95064] *** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: ReferenceError: Can't find variable: typeAnnotation', reason: 'Unhandled JS Exception: ReferenceError: Can't find variable: typeAnnotation, stack:
<unknown>@1064:17089
v@2:1474
<unknown>@1063:426
v@2:1474
<unknown>@1062:340
v@2:1474
<unknown>@1055:6339
v@2:1474
<unknown>@1054:156
v@2:1474
<unknown>@1053:229
v@2:1474
<unknown>@1051:167
v@2:1474
<unknown>@847:284
v@2:1474
<unknown>@846:211
v@2:1474
<unknown>@442:454
v@2:1474
<unknown>@413:400
v@2:1474
<unknown>@412:138
v@2:1474
<unknown>@6:61
v@2:1474
d@2:876
global code@1935:4
'
*** First throw call stack:
(
0 CoreFoundation 0x00000001108b0e6e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x000000010fb779b2 objc_exception_throw + 48
2 EPG 0x000000010a3f6f05 RCTFormatError + 0
3 EPG 0x000000010a46c11c -[RCTExceptionsManager reportFatalException:stack:exceptionId:] + 508
4 CoreFoundation 0x00000001108b7dec __invoking___ + 140
5 CoreFoundation 0x00000001108b4fd1 -[NSInvocation invoke] + 321
6 CoreFoundation 0x00000001108b52a4 -[NSInvocation invokeWithTarget:] + 68
7 EPG 0x000000010a42ab0a -[RCTModuleMethod invokeWithBridge:module:arguments:] + 578
8 EPG 0x000000010a42cd94 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 246
9 EPG 0x000000010a42cb1c ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 78
10 libdispatch.dylib 0x00000001139daf11 _dispatch_call_block_and_release + 12
11 libdispatch.dylib 0x00000001139dbe8e _dispatch_client_callout + 8
12 libdispatch.dylib 0x00000001139e26fd _dispatch_lane_serial_drain + 788
13 libdispatch.dylib 0x00000001139e328f _dispatch_lane_invoke + 422
14 libdispatch.dylib 0x00000001139eeb65 _dispatch_workloop_worker_thread + 719
15 libsystem_pthread.dylib 0x00007fff52301a3d _pthread_wqthread + 290
16 libsystem_pthread.dylib 0x00007fff52300b77 start_wqthread + 15
)
libc++abi.dylib: terminating with uncaught exception of type NSException
有沒有人知道什么可能導致和問題這樣,我將 react-native 的版本設置為“react-native”:“^0.61.2”和我的 package。 json 看起來像:
{
"name": "My App",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "cd ./android && ./gradlew app:assembleDebug && ./gradlew installDebug",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"@react-native-community/async-storage": "1.8.1",
"@react-native-community/datetimepicker": "3.0.8",
"@react-native-community/push-notification-ios": "1.1.0",
"@react-native-firebase/analytics": "6.7.1",
"@react-native-firebase/app": "6.7.1",
"@react-native-firebase/messaging": "6.7.1",
"base64url": "3.0.1",
"i18n-js": "3.5.1",
"lodash": "4.17.15",
"moment": "2.24.0",
"native-base": "2.13.12",
"react": "16.9.0",
"react-native": "^0.61.2",
"react-native-camera": "3.21.0",
"react-native-collapsible": "1.5.2",
"react-native-color-picker": "0.6.0",
"react-native-config": "0.12.0",
"react-native-dash": "0.0.11",
"react-native-document-picker": "3.3.2",
"react-native-easy-grid": "0.2.2",
"react-native-geocoding": "0.4.0",
"react-native-image-picker": "1.1.0",
"react-native-image-resizer": "1.2.1",
"react-native-keyboard-aware-scrollview": "2.1.0",
"react-native-linear-gradient": "2.5.6",
"react-native-localize": "1.3.4",
"react-native-maps": "0.26.1",
"react-native-navigation": "3.7.0",
"react-native-open-maps": "0.3.5",
"react-native-pdf": "6.1.0",
"react-native-picker-select": "6.6.0",
"react-native-print": "0.6.0",
"react-native-push-notification": "3.1.9",
"react-native-ratings": "6.5.0",
"react-native-restart": "0.0.13",
"react-native-share": "3.1.2",
"react-native-ssl-pinning": "1.4.5",
"react-native-tag-input": "0.0.21",
"react-native-webview": "7.6.0",
"react-redux": "7.2.0",
"redux": "4.0.5",
"redux-thunk": "2.3.0",
"rn-fetch-blob": "0.12.0",
"rn-secure-storage": "2.0.4"
},
"devDependencies": {
"@babel/core": "7.9.0",
"@babel/runtime": "7.12.5",
"@react-native-community/eslint-config": "0.0.5",
"babel-jest": "24.9.0",
"eslint": "6.8.0",
"jest": "24.9.0",
"metro-react-native-babel-preset": "0.56.4",
"react-test-renderer": "16.9.0"
},
"jest": {
"preset": "react-native"
}
}
我已經通過卸載 node_modules 並多次安裝 pod 進行了嘗試,但沒有使用任何解決方案對其進行修復。
幫助將不勝感激。 提前致謝。
我昨天解決了這個問題,嘗試在您的代碼中查找類似 @babel/types 的內容,它是從 '@babel/types' 中刪除 import { identifier }; ——阿哈倫·維辛斯基
謝謝 aharon vishinsky——這對我很有幫助。
就我而言:vscode 插件“自動導入”似乎插入了“導入”語句:
import { OBJECTMEMBER_TYPES } from '@babel/types';
所以,只要刪除它,那么你應該沒問題。
非常感謝,這幾天一直在這。 就我而言,看起來 VSCode 在某個時候添加了這個。
import { placeholder } from "@babel/types";
很可能是當我為 TextInput 添加占位符時。 刪除此行解決了該問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.