138

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:

enter image description here

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

enter image description here

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

Mateo Guzmán
  • 1,206
  • 1
  • 15
  • 27
Asad
  • 3,070
  • 7
  • 23
  • 61

31 Answers31

191

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

Brijesh Shiroya
  • 3,323
  • 1
  • 13
  • 20
48

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

npm start --reset-cache
Saeed Zhiany
  • 2,051
  • 9
  • 30
  • 41
Chetan J Rao
  • 905
  • 9
  • 14
16

Clear the cache with the following command:

react-native start --reset-cache
Arslan Shahab
  • 639
  • 3
  • 9
6

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

Chiamaka Nwolisa
  • 951
  • 8
  • 15
5

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
t.ios
  • 1,024
  • 12
  • 18
3

Close the current Metro Bundler and restart by typing the comment:

npm start -- --reset-cache
Nimantha
  • 6,405
  • 6
  • 28
  • 69
Socheat Yorn
  • 75
  • 1
  • 2
3

Stop the node server running and run 'react-native run-ios' once again.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
cherucole
  • 560
  • 7
  • 15
3

I tend to get this error after I install a new package that has some native code that needs to be installed with it. Usually packages will say install npm module and then install native code via a pod install (ios specific) and after this my app usually throws this error.

In order to get rid of this error I delete and reinstall node_modules and pods since I am making an iOS app and then I also delete the build folder under ios. After that I run the packager with npm start -- --reset-cache and build my app again using the react-native run-ios command. This fixes the issue for me.

Jose
  • 1,959
  • 20
  • 21
  • 2
    `error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening coreApp.xcworkspace.` This dev environment is such a nightmare. – velkoon Aug 05 '21 at 19:32
2

Worked for me for below version and on iOS:

"react": "16.9.0",
"react-native": "0.61.5",

Step to resolve
Close the current running Metro Bundler
Try Re-run your Metro Bundler and check if this issue persists

Nimantha
  • 6,405
  • 6
  • 28
  • 69
sahu
  • 1,188
  • 10
  • 19
2

In my case, trying npm start -- --reset-cache and getting a bunch more errors, I deleted (uninstalled) the app from iOS and Android and yarn ios yarn android did the trick.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Zhengqian Kuang
  • 1,079
  • 1
  • 9
  • 12
2

I ended up creating an entirely new react-native project after a computer restart and after the deletion/rebuild of the npm_modules folder, Pods folder, and my ios build folder did not work. (Quitting the Simulator, Quitting the Terminal app, Quitting XCode, cleaning the project folder in XCode, and running killall -9 node, npm start -- reset-cahce & npm start -- --reset-cache did not work, either). After installing all my packages, I copied and pasted my code from my old project to the new one. Same error. So then I started backtracking my most recent code changes, step by step. After reverting my most recent code changes, it worked. While adding new code little by little, I got an error telling me I forgot to import {StyleSheet} from 'react-native';. I imported that, then continued adding my code that had previously led to the error (which was simply a react-native-elements Button and a StyleSheet const styles). All went well.

So, in the end, my only theory is that I had added too much code at once, and instead of telling me I forgot to import {StyleSheet} like it should have, it instead threw me a vague and infuriating module AppRegistry error.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
velkoon
  • 871
  • 3
  • 15
  • 35
1

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

Asad
  • 3,070
  • 7
  • 23
  • 61
1

This happens for one of these reasons:-

  • Either, your app's entry file 'index.js' is corrupt due to syntax error or your React App could not load.
  • Your Metro Bundler instance running is stale and corrupt.

Solution

  • Terminate already running Metro Bundler instance

  • Reset Cache

    react-native start --reset-cache
    
  • Delete android/app/bulid folder

  • Start server again

Shiva
  • 11,485
  • 2
  • 67
  • 84
1

Just closing the metro bundler and rebuilding the app done my job.

Siraj Alam
  • 9,217
  • 9
  • 53
  • 65
1
  1. Close Emülator

  2. npm start -- --reset-cache

  3. XCode -> Product -> Clean Build Folder

  4. npx react-native run-ios

Nimantha
  • 6,405
  • 6
  • 28
  • 69
1

I tried killall -9 node command in terminal

then again i run my project using npm start and it's working fine

Lakshya Tyagi
  • 79
  • 1
  • 5
0

Need to replace

.setJSMainModulePath("index") with .setJSMainModulePath("index.android")
Aristo Michael
  • 2,166
  • 3
  • 35
  • 43
0

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.

Harry B
  • 2,864
  • 1
  • 24
  • 44
  • I'm sure other solutions will work for some. For me a restart was the only solution I could find. Hardly drastic vs spending hours trying to debug. It's just one option. – Harry B Aug 29 '18 at 08:34
0

If you are using windows and running yarn open cmd on admin mode' terminate and Restart the node process by typing this command.

Find the node: killall -9 node force to kill : taskkill /f /im node.exe Reset the cache : yarn start --reset-cache

Navigate to your project directory: cd myapp Re-Run your App : yarn android

0

In my case, I didn't import a module in a component that I was using it in.

So, just check if you are importing the module you want to use...

Filip Savic
  • 2,737
  • 1
  • 29
  • 34
0

One of the libraries has not been linked. To check, just comment out in the package.json one by one the latest libraries added.

yarn remove libraryName.

Then run the app with xcode and puf !

Ruben Mim
  • 136
  • 1
  • 6
0

If your are building a new npm module and this rely on some other dependencies already added in your project, you need to add those dependencies in the package.json of the npm package as peer dependency.

package.json

"peerDependencies":{
 "@org/your-dependency":">= 1.2.0"
}
[Tue Aug 31 2021 17:57:45.731]  ERROR    Error: Type oid already present, js engine: hermes
[Tue Aug 31 2021 17:57:45.732]  ERROR    Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication), js engine: hermes
[Tue Aug 31 2021 17:57:45.732]  ERROR    Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication), js engine: hermes
Ivan Cabrera
  • 337
  • 4
  • 9
0

For me, the issue was starting the metro bundler when there was an error in one of my styles. I had an error in my code from last night, and then my computer did a restart overnight. Trying to start everything up today resulted in this error along with Invariant Violation: Invalid prop 'position' of value 'fixed' supplied to. Fixing the position value resolved both errors.

John Harding
  • 432
  • 1
  • 6
  • 14
0

npm start -- --reset-cache

react-native run-ios

works for me.

M Mahmud Hasan
  • 1,303
  • 1
  • 13
  • 20
0

One single error but there might be multiple causes. Seeing a lot of diverse discussions in the community means this issue could be hard to find. Try to proceed with the following.

  1. There might be a missing import.
  2. There might be a missing configuration with the library you recently installed.
  3. You may not receive errors in Android but in IOS. Then one of the lib configurations in IOS is missing.
  4. Your cache needs to be reset if RN is upgraded.

If you still cannot find the issue with the above, remove some imports or screens from your App.js. Going with this you can find what exactly caused this error. This is how I found my issue after a day of research.

Click to see further Github issues

Sabri Meviş
  • 2,231
  • 1
  • 32
  • 38
0

closing your current metro bundle and run this :--

npm start -- --reset-cache
Tyler2P
  • 2,324
  • 26
  • 22
  • 31
ND verma
  • 171
  • 1
  • 9
0

delete node_modules and install it again using npm i then apply this command npm start -- --reset-cache

dude_blag
  • 135
  • 1
  • 4
  • 14
0

in addition to all the above, it's worth to try to find and comment out the following code somewhere in you redux store directory:

.concat(composeWithDevtools)

It fixed the issue for me.

Vlad R
  • 1,851
  • 15
  • 13
-1

I was also suffering from the same error for windows OS. I resolved this by cleaning gradlew.

The steps are:

  1. cd android
  2. gradlew clean
  3. cd..
oguz ismail
  • 1
  • 16
  • 47
  • 69
-2

The solution is very simple just kill all the running nodes and restart your node server and rebuild your native application and it works.

For Linix:

killall -9 node

For Windows:

taskkill /im node.exe

For Android native App:

react-native run-android 

For IOS native App:

react-native run-ios

Then finally,

npm start
-3
import { AppRegistry } from 'react-native';

AppRegistry.registerComponent('your app name',  () => point);
Suraj Rao
  • 29,388
  • 11
  • 94
  • 103