Connect the React Native Emulator to Intellij IDEA

React Native displays a red screen when an error occurs in debug mode:

The great thing here is that you can jump to the source file by clicking the relevant line of the stack trace. This is incredible helpful if the error is located in your dependencies. The node_modules folder of my current project counts 731 subdirectories. Searching manually is absolutely frustrating.

In my case the source file was always opened in Visual Studio Code while I’m developing with Intellij IDEA. I never knew how to configure this until I noticed this hint:

When you see Red Box with stack trace, you can click any stack frame to jump to the source file. The packager will launch your editor of choice. It will first look at REACT_EDITOR environment variable, then at EDITOR. To set it up, you can add something like export REACT_EDITOR=atom to your ~/.bashrc or ~/.zshrc depending on which shell you use.

No idea why I didn’t notice this earlier but perhaps I’m not the only one … Remaining question is: How do you open Intellij IDEA from command line?

In IDEA go to “Tools” -> “Create Command-line Launcher…”. Then set the path of the launcher script and export it in your .*rc file.

Like what you read? Give Florian Hirsch a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.