skip to Main Content

I am working on react-native cli project. In this project I got errors which starting the dev server which is as follows:

ERROR Invariant Violation: "frontendnative" has not been registered. This can happen if:* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
A module failed to load due to an error and AppRegistry.registerComponent wasn’t called., js engine: hermes

There is no problem with index.js file also the name of the project is same as there. Here is the code snippet of index.js file:

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

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

Also name is correctly defined in app.json file which is as follows:

{
  "name": "frontendnative",
  "displayName": "frontendnative"
}

Also in package.json file name is correct with name "frontendnative". I am currenly using react-native v0.73.7 and metro v0.80.8

How to solve this error?

I found errors. Which is likely the errors

ERROR Invariant Violation: "frontendnative" has not been registered. This can happen if:* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
A module failed to load due to an error and AppRegistry.registerComponent wasn’t called., js engine: hermes

2

Answers


  1. I had similar issue and it didn’t got resolved by any other answers on Stack Overflow or Github. After going a little deep I realized it was happening due to a npm package was not installed correctly.

    I created a new folder and pasted all my code except node_modules and cleared all extra added dependencies in package.json.
    Than used npm install to get initial node_modules.
    Than I cleared App.js code and wrote a simple code which return

    //App.js
    import {View} from "react-native";
    export default function App(){
       return <View/>
    }
    

    After that I added one package at a time one by one and kept reloading app in Expo Go. Finally I found out the root of problem:
    react-native-reanimated.
    Installation of that package requires some changes in babel.config.js which I missed and hence got the problem. I uninstalled it and reinstalled as guided in documentation and yeah it worked ! Hope you find yours, the method seems quite lengthy but it worked for me.

    Login or Signup to reply.
  2. try cd andoroid ./gradlew clean or npm update sometimes update cause errors.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search