模块 AppRegistry 不是已注册的可调用模块 [英] Module AppRegistry is not a registered callable module

查看:52
本文介绍了模块 AppRegistry 不是已注册的可调用模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从 React Native 开发开始,一开始就遇到了一个问题.尝试运行我的应用时出现错误:

I'm starting with React Native development and I encountered an issue in the very beginning. When trying to run my app I get errors:

Invariant Violation: Module AppRegistry 不是注册的可调用模块(调用 runApplication)
未处理的 JS 异常:不变违规:本机模块不能为空.
未处理的 JS 异常:不变违规:模块 AppRegistry 不是已注册的可调用模块(调用 runApplication)

Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
Unhandled JS Exception: Invariant Violation: Native module cannot be null.
Unhandled JS Exception: Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)

我的 App.js:

import React, { Component } from 'react';
import { SafeAreaView } from 'react-native';
import DefaultRouter from './src/navigation/DefaultRouter'

export default class App extends Component {
  render() {
    return (
      <SafeAreaView>
        <DefaultRouter />
      </SafeAreaView>
      );
    }
  };

index.js:

import { AppRegistry } from 'react-native';
import App from './App';
import {name as appName} from './app.json';

AppRegistry.registerComponent(appName, () => App);

DefaultRouter.js:

DefaultRouter.js:

import { createSwitchNavigator, createAppContainer } from 'react-navigation';
import LoginScreen from '../screen/LoginScreen';
import DefaultTabBar from '../navigation/TabBar';

const DefaultRouter = createSwitchNavigator({
    LOGIN_SCREEN: {
        screen: LoginScreen
    },
    TAB_NAVIGATION: {
        screen: DefaultTabBar
    }
}, {
    initialRouteName: 'LOGIN_SCREEN',
    headerMode: 'none'
})

export default createAppContainer(DefaultRouter)

其他文件是简单的Component 子类.

Other files are simple Component subclasses.

无论我是从 Visual Studio Code 还是从带有 react-native run-ios

The issue manifests regardless if I run the app from Visual Studio Code or from terminal with react-native run-ios

我查看了现有的答案,但没有找到任何可以为我指明正确方向的内容:
React-Native:Module AppRegistry 不是注册的可调用模块
React Native:Module AppRegistry 不是一个注册的可调用模块(调用 runApplication)
模块 appregistry 不是注册的可调用模块(调用 runApplication)模块 AppRegistry 不是注册的可调用模块和找不到变量:常量
React Native 模块 AppRegistry 不是注册的可调用模块
模块 AppRegistry 不是已注册的可调用模块仅在发布配置中

I looked through existing answers and I didn't find anything that could point me in the right direction:
React-Native: Module AppRegistry is not a registered callable module
React Native: Module AppRegistry is not a registered callable module (calling runApplication)
module appregistry is not a registered callable module (calling runApplication) Module AppRegistry is not a registered callable module and Cant find variable: Constants
React Native Module AppRegistry is not a registered callable module
Module AppRegistry is not a registered callable module only in Release configuration

我被困住了,我不知道从哪里开始

I'm stuck and I don't know where to go from here

推荐答案

运行 npm cache verifycd ios &&pod install 然后 npm run ios

这篇关于模块 AppRegistry 不是已注册的可调用模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆