类型错误:r(d[2]) 不是函数。(在“r(d[2])(this)”中,“r(d[2])”是对象的实例)仅在 Android 上的发布应用程序中

Var*_*pta 5 react-native yarn-workspaces metro-bundler

我正在使用纱线工作区将我的反应本机应用程序转换为单一存储库。将逻辑代码移至共享包后,我可以在调试模式下运行应用程序并创建发布 apk。但是当我在设备上运行发布 apk 时,应用程序会因错误而中止

TypeError: r(d[2]) is not a function. (In 'r(d[2])(this)', 'r(d[2])' is an instance of Object)

它没有给出有关实际错误发生位置的任何其他提示。

看起来有些人已经看到了类似的问题,但我无法从这些帖子中找到任何解决方案。我发现两个类似的错误

https://github.com/mattermost/mattermost-mobile/issues/2757

https://forums.expo.io/t/typeerror-r-is-not-a-function-only-on-device-not-simulator/20985

我想知道如何收集有关此错误的更多信息以修复它。目前,代码似乎被缩小了,因此我无法准确地确定错误发生的位置。

下面是完整的错误:

2020-12-16 09:22:28.909 428-494/? E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
    Process: com.myapp, PID: 428
    com.facebook.react.common.JavascriptException: TypeError: r(d[2]) is not a function. (In 'r(d[2])(this)', 'r(d[2])' is an instance of Object), stack:
    <unknown>@521:145
    exports@477:81
    <unknown>@522:79
    h@2:1585
    <unknown>@521:139
    <unknown>@600:136
    <unknown>@551:319
    t@546:312
    <unknown>@605:70
    t@546:312
    <unknown>@603:94
    t@543:120
    <unknown>@541:513
    h@2:1585
    <unknown>@540:104
    h@2:1585
    <unknown>@539:185
    h@2:1585
    <unknown>@538:1122
    h@2:1585
    <unknown>@528:544
    h@2:1585
    <unknown>@527:109
    h@2:1585
    <unknown>@526:898
    h@2:1585
    <unknown>@466:207
    h@2:1585
    <unknown>@6:122
    h@2:1585
    d@2:958
    global code@2064:3
    
        at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.java:83)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
        at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:151)
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
        at android.os.Looper.loop(Looper.java:193)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)
        at java.lang.Thread.run(Thread.java:764)
Run Code Online (Sandbox Code Playgroud)

下面是我当前的 package.json

{
  "name": "MyApp",
  "version": "3.11.0",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint .",
    "prepare": "cd .. && yarn patch-package"
  },
  "dependencies": {
    "@react-native-community/datetimepicker": "3.0.8",
    "@react-native-community/netinfo": "5.9.9",
    "@react-native-community/push-notification-ios": "1.8.0",
    "@react-native-community/slider": "3.0.3",
    "@react-native-firebase/analytics": "10.2.0",
    "@react-native-firebase/app": "10.2.0",
    "@react-native-firebase/auth": "10.2.0",
    "@react-native-firebase/database": "10.2.0",
    "@react-native-firebase/dynamic-links": "10.2.0",
    "@react-native-firebase/messaging": "10.2.0",
    "@react-native-firebase/storage": "10.2.0",
    "@sentry/react-native": "2.1.0",
    "fast-deep-equal": "3.1.3",
    "fast-memoize": "2.5.2",
    "firebase": "8.2.0",
    "my-config": "1.0.0",
    "my-ps-api": "1.0.0",
    "my-res": "1.0.0",
    "my-shared": "1.0.0",
    "i18n-js": "3.8.0",
    "invariant": "2.2.4",
    "libphonenumber-js": "1.9.6",
    "lodash": "4.17.20",
    "moment-timezone": "0.5.32",
    "prop-types": "15.7.2",
    "react": "17.0.1",
    "react-fast-compare": "3.2.0",
    "react-native": "0.64.0-rc.1",
    "react-native-action-button": "2.8.5",
    "react-native-animatable": "1.3.3",
    "react-native-collapsible": "1.5.3",
    "react-native-communications": "2.2.1",
    "react-native-config": "1.4.1",
    "react-native-contacts": "6.0.3",
    "react-native-country-picker-modal": "2.0.0",
    "react-native-device-info": "7.3.1",
    "react-native-dialogs": "1.1.1",
    "react-native-elements": "3.0.0-alpha.1",
    "react-native-fast-image": "8.3.4",
    "react-native-gifted-chat": "github:varungupta85/react-native-gifted-chat",
    "react-native-iap": "5.2.0",
    "react-native-image-crop-picker": "0.35.1",
    "react-native-keyboard-aware-scroll-view": "0.9.3",
    "react-native-keyboard-spacer": "0.4.1",
    "react-native-localize": "2.0.1",
    "react-native-navigation": "6.12.2",
    "react-native-parsed-text": "0.0.22",
    "react-native-permissions": "3.0.0",
    "react-native-radio-buttons": "1.0.0",
    "react-native-sound": "0.11.0",
    "react-native-store-review": "0.1.5",
    "react-native-swiper": "1.6.0",
    "react-native-uuid": "1.4.9",
    "react-native-vector-icons": "7.1.0",
    "react-redux": "7.2.2",
    "redux": "4.0.5",
    "redux-batched-subscribe": "0.1.6",
    "redux-persist": "6.0.0",
    "redux-thunk": "2.3.0",
    "reduxsauce": "1.2.0",
    "reselect": "4.0.0",
    "url": "0.11.0",
    "uuid": "8.3.2"
  },
  "devDependencies": {
    "@babel/core": "7.8.4",
    "@babel/runtime": "7.8.4",
    "@react-native-community/eslint-config": "1.1.0",
    "babel-jest": "25.1.0",
    "eslint": "6.5.1",
    "jest": "25.1.0",
    "metro-react-native-babel-preset": "0.64.0",
    "react-native-codegen": "0.0.6",
    "react-test-renderer": "17.0.1",
    "reactotron-react-native": "2.2.0",
    "reactotron-redux": "2.1.3"
  },
  "jest": {
    "preset": "react-native"
  }
}
Run Code Online (Sandbox Code Playgroud)