質問

I created webstorm external tool which throws some errors but running the same task from terminal works fine.I understand that this is because when run in webstorm the $PATH variable is set different from that of the terminal case. There isn't any option to set environmental variable while creating an external tool. How do I set $PATH for external tools in webstorm/rubymine? External tool I was creating was a grunt task and OS is ubuntu if that helps.

This is the error: Error running grunt server: Cannot run program "grunt": error=2, No such file or directory

役に立ちましたか?

解決

There is a feature request to support environment variables for the external tools.

Current workarounds:

  • Make GUI apps environment the same as in Terminal per this answer
  • Run your script via bash --login (external tool runs bash login shell that sets the environment and executes the script name passed as a parameter)

他のヒント

For OSX:

Open ‘/Applications/Webstorm.app/Contents/Info.plist’ in your favorite editor.

Find the following section and replace [Your Path Value]

<key>LSEnvironment</key>
<dict>
    <key>PATH</key>
    <string>[Your Path Value]</string>
</dict>

Then run:

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -v -f /Applications/WebStorm.app

I got this fix from a fantastic article by Ifeanyi Isitor

http://ify.io/getting-webstorm-external-tools-to-work-on-webstorm-on-osx

I've found a dirty-workarround for linux. Create a file (e.g phpstorm_wrapper) and put this inside:

#!/bin/bash
if [ $# > 1 ]; then
  exec "$@"
else
 eval "$1"
fi

Save and make it executable.

USAGE:

Now you can run the wrapper-script as Program: in your "external tools" and set all Parameters you like to the Arguments inputfield.

The script will execute it and return the result of it.


If you need to use ENV-Variable, you must use env command like this:

env FASTLANE_JSON_KEY_FILE=./release_manager.json fastlane test

enter image description here


If you need to use | (pipes), phpstorm put it in quotes. To be able to execute commands which use |, encapsulate the whole Textfield "Arguments" in the external tool dialoge in quotes.

Example:

enter image description here

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top