React Native:模块AppRegistry不是注册的可调用模块(调用runApplication)

时间:2019-05-31 15:22:44

标签: ios reactjs react-native

我正在尝试使用High Sierra上Xcode 10.1的模拟器通过React 16.2.0启动React Native 0.53.3应用程序。

我以前遇到过一些问题,这些问题已经解决,只是为了使构建成功: npm-shrinkwrap.json: Could not install from "node_modules/react-navigation/react-native-tab-view@github:react-navigation/react-native-tab-view

React Native: ":CFBundleIdentifier", Does Not Exist

即使我继续出现cfbundleridentifier错误,现在所有构建都成功:

Check dependencies



** BUILD SUCCEEDED **


Installing build/Build/Products/Debug-iphonesimulator/NFIBEngage.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist

Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/NFIBEngage.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

即使在Metro Bundler中,它也会成功:

Metro Bundler ready.

Loading dependency graph, done.
 BUNDLE  [ios, dev] ./index.ios.js ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.0% (1667/1667), done.

 BUNDLE  [ios, dev] ./index.ios.js ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.0% (1/1), done.

 DELTA  [ios, dev] ./index.ios.js ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.0% (1667/1667), done.

 MAP  [ios, dev] ./index.ios.js ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.0% (1667/1667), done.

所以我想知道为什么我的应用在模拟器中启动时为什么会停留在启动画面中,通常仅在index.ios.js失败时才会发生。因此,我查看了http://localhost:8081/debugger-ui/,并确定看到了以下错误:

Module AppRegistry is not a registered callable module (calling runApplication)

Unhandled JS Exception: Cannot read property 'invocationEventNone' of undefined

Unhandled JS Exception: Module AppRegistry is not a registered callable module (calling runApplication)

我不知道它从哪里得到invocationEventNone,我检查的不是代码库中写的任何东西。

As far as the `AppRegistry` module, it appears to look fine:

import {AppRegistry} from 'react-native';
import KeyboardManager from 'react-native-keyboard-manager';
import NFIBEngage from './App';

KeyboardManager.setToolbarPreviousNextButtonEnable(true);

AppRegistry.registerComponent('NFIBEngage', () => NFIBEngage);

有没有人遇到过类似我正在运行的运行版本的东西?我应该调查什么?该如何解决?

我在这里关注了所有解决方案: Module AppRegistry is not registered callable module (calling runApplication)

这里没有什么可以帮助您的: React Native Module AppRegistry is not a registered callable module

这无关紧要: React Native(iOS) Module AppRegistry is not a registered callable module (calling runApplication)

不相关: React native AppRegistry is not a callable module

然后我尝试遵循iDevAmit提供的解决方案: React-Native: Module AppRegistry is not a registered callable module

但是似乎我现在正在运行的iOS已根据以下输出链接:

rnpm-install info Platform 'ios' module appcenter is already linked
rnpm-install info Linking appcenter android dependency
rnpm-install info Platform 'android' module appcenter has been successfully linked
iOS App Secret is '00000000-0000-0000-0000-000000000000' set in ios/NFIBEngage/AppCenter-Config.plist
Added code to initialize iOS AppCenter SDK in ios/NFIBEngage/AppDelegate.m

            Could not install dependencies using CocoaPods.
            Please refer to the documentation to install dependencies manually.

            Error Reason - Could not find "pod" command. Is CocoaPods installed?

Configuring AppCenter Analytics
rnpm-install info Platform 'ios' module appcenter-analytics is already linked
? For the Android app, should user tracking be enabled automatical
ly? (Use arrow keys)
❯ Enable Automatically
  Enable in JavaScript iOS App Secret is '00000000-0000-0000-0000-000000000000' set in ios/NFIBEngage/AppCenter-Config.plist
? For the iOS app, should user tracking be enabled automatically?
(Use arrow keys)
❯ Enable Automatically
  Enable in JavaScript

我用Ctrl + C退出了,我不知道CocoaPods消息是否相关,因为我从未使用过它。有一次我尝试使用pod install并且zsh找不到pod作为命令。

Omar的解决方案不起作用,因为它给了我Duplicate declaration "appName"

其他任何建议均不适用,升级React Native不是该项目的选择。

在我的Xcode 10.1中,我在项目设置->高级按钮中拥有当前配置:

enter image description here

在此帖子中: React Native IOS Build CFBundleIdentifier Does not Exist

我已经有了SUMIT和priyanga推荐的产品。

1 个答案:

答案 0 :(得分:0)

解决此错误的方法是从Instabug文件中删除App.js库和代码:

export default class appName extends PureComponent {
  constructor() {
    super();
    this._startSentry();
    // if (Platform.OS === "ios") {
    //   const key = base === "prod" ? env.instabug.prod : env.instabug.beta;
    //   Instabug.startWithToken(key, Instabug.invocationEvent.twoFingersSwipe);
    // }
    // Instabug.setIntroMessageEnabled(false);
    // appcenter.trackAppOpened();
  }

我还得到invocationEvent的错误和AppRegistry错误的出现。