Reputation: 2072
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
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:
⇧
twice to open the search windowThat'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
Reputation: 122
I solved this problem by creating symlink.
sudo ln -s /Applications/WebStorm.app/Contents/MacOS/webstorm /usr/local/bin/webstorm
Upvotes: 0