Invariant Violation: Metro is run from wrong folder issue

Figure 1: Error while running project

If you’re getting error as shown in the figure above while running react-native project, which shows invariant violation, the this blog can be useful to solve the issue. The issue generally occurs when the project name is not matching with the name that you’re using in app.json.

Figure 2: app.json file with project name

First of all, open app.json file of your react-native project and check the name section whether it is the same that is showing in metro or not. If it is different, make it same and kill the metro by using below command and run the project. This time the project will run properly.

cd android
./gradlew --stop

I hope this blog helped you to fix the issue of react-native. You can also follow the video tutorial below.

Leave a Reply

Your email address will not be published. Required fields are marked *