Module AppRegistry is not registered callable module (calling runApplication)

这一生的挚爱 提交于 2019-11-26 14:04:19

问题


I am using native base for making app in react-native. I am new to both things. When I run the app It gives me this error:

Here is my code:

export default class Point extends Component {

    render() {
        return (
            <Container>
                <Header>
                    <Left>
                        <Button transparent>
                            <Icon name='menu' />
                        </Button>
                    </Left>
                    <Body>
                        <Title>Header</Title>
                    </Body>
                    <Right />
                </Header>
            </Container>
        );
    }
}

Here is the screenshot of my versions

and nativebase version is "native-base": "^2.1.2"


回答1:


Just kill all node process and start npm server and run application:

Step1: run command killall -9 node

For windows users, run: taskkill /im node.exe

Run taskkill /f /im node.exe if the process still persists.

Step2: run command npm start --reset-cache

Step3: run command react-native run-ios OR react-native run-android




回答2:


Closing the current Metro Bundler and restarting by resetting the cache worked for me

npm start -- --reset-cache



回答3:


You should have this at the bottom of the index.ios.js file AppRegistry.registerComponent('Point', () => Point); and also import AppRegistry from react-native




回答4:


I had this issue - it was odd because I reset my repo to a time when the app was working. The issue was with my simulator (iOS).

For me the solution was to

  1. kill the simulator program (quit)
  2. then - close the terminal window that is opened when simulator is ran (Metro Bundler) Image of my terminal window



回答5:


I was using native base for my app here is link native base

and you can see there is no app registry like this

 AppRegistry.registerComponent('Point', () => Point) 

but i have to do this to run my app




回答6:


Need to replace

.setJSMainModulePath("index") with .setJSMainModulePath("index.android")



回答7:


For me, restarting my computer appears to be enough to clear this issue.

It's often required after I've switched between branches, or merged branches using git.




回答8:


I am using Expo

In my case, I resolved the issue by adding the following code in app.json file

"expo":{
  ...
  "android": {
    "package": "com.mycompanyname.myappname
  }
}



回答9:


import { AppRegistry } from 'react-native';

AppRegistry.registerComponent('your app name',  () => point);



回答10:


I have solved it, just closing the current Metro Bundler and restarting by type comment below.

npm start -- --reset-cache


来源:https://stackoverflow.com/questions/43604603/module-appregistry-is-not-registered-callable-module-calling-runapplication

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!