Abdo Rabah
Abdo Rabah

Reputation: 2072

How to set React_Editor to PhpStorm so that when you click on the error it jumps to the code?

I'm using PhpStorm in Mac to code and i want to debug my errors. I have a message in my terminal to set the editor for React Native tools.

    PRO TIP 
  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.

I've added these lines to ~/.bashrc but nothing happened when i click on the error :

export PATH=$PATH:/usr/local/bin/pstorm
export REACT_EDITOR=pstorm

How can i set correctly REACT_EDITOR to PhpStorm so that when i click on the error it jumps to my code?

Upvotes: 5

Views: 2705

Answers (2)

Stanislav Mayorov
Stanislav Mayorov

Reputation: 4452

UPD for webstorm 2023.1

Just add to ~/.bashrc or ~/.zprofile.

export REACT_EDITOR="webstorm"
export PATH="/Applications/WebStorm.app/Contents/MacOS:$PATH"

Don't forget to close all of your terminal windows and restart the react-native packager before you try it.

Original answer for previous version of webstorm.

For mac os you need to add to ~/.bashrc or .zprofile:

Add export REACT_EDITOR="webstorm" or pstorm

Don't forget to close all of your terminal windows and restart the react-native packager before you try it.

Create a shortcut to open WebStorm:

  1. Open WebStorm
  2. Press twice to open the search window
  3. Type “Create Command Line Launcher…” and press Enter
  4. Click OK enter image description here

That's it.

/usr/local/bin should be in the PATH environment variable by default. You should be able to run webstorm from anywhere in the shell. Run webstorm /usr/local/bin/webstorm to test the command.

You can find a code which opens editors here or in your project node_modules/@react-native-community/cli-tools/build/launchEditor.js

Upvotes: 7

Erhan Biçer
Erhan Biçer

Reputation: 122

I solved this problem by creating symlink.

sudo ln -s /Applications/WebStorm.app/Contents/MacOS/webstorm /usr/local/bin/webstorm

Upvotes: 0

Related Questions