Hobbamok
Hobbamok

Reputation: 848

WebStorm: bash script errors when run with "run", but works when executed in the console

I wrote a build script for my project (maven, grunt as well as some server-reconfiguration), and when I use the WebStorm command-line with

~/Projects/javaee-angularjs$ ./launchServer.sh 

Everything works as expected.

However, when I configure the file to be run by WebStorm (the green triangle top-right) it fails because of: /home/user/Projects/javaee-angularjs/launchServer.sh: line 29: grunt: command not found

The run-config should be absolutely correct: working directory is the correct one and the script is found to begin with.

Any Idea what could cause this weird behavior?

P.S. I don't know whether WebStorm can run bash natively, since I've always had the bash plugin installed.

Upvotes: 1

Views: 441

Answers (2)

lena
lena

Reputation: 93858

Try starting WebStorm from terminal - does the issue persist?

When being launched from desktop/System menu, WebStorm only sees environment variables configured in ~/.profile (login shell), but not in interactive shell configuration files (like ~/.bashhrc). Possible workarounds:

  • Workaround 1: make required variables available in a login shell (i.e. for bash, move them from .bashrc to .bash_profile).
  • Workaround 2: run IDE from a terminal, via bin/webstorm.sh
  • Workaround 3: edit the desktop launcher and set command to /bin/bash -l -i -c "/path/to/webstorm.sh"

see also https://youtrack.jetbrains.com/issue/IDEABKL-7589

Upvotes: 4

Lewis M
Lewis M

Reputation: 548

The error sounds like Webstorm cannot find grun in its path. Try using the full path to the grunt command.

Upvotes: 2

Related Questions