9

I need help setting up my SCSS file watcher in PhpStorm. I'm on Ubuntu, I have PhpStorm 6, I have RVM with Ruby 1.9.3p194 and Sass 3.2.5. I've set my File Watcher options in, Settings >> File Watcher as follows:

enter image description here

Once I had done that, I changed something in my .SCSS file but I got this error.

...-1.9.3-p194/bin/sass --no-cache --update style_update.scss:style_update.css
/usr/bin/env: ruby: No such file or directory

(I added three dots at the begin of the first line to make the line shorter) So what might be the problem?

tsega
  • 856
  • 2
  • 15
  • 31
  • 1
    Check that `ruby` is in your `PATH` and you can run it. Sometimes environment available to PhpStorm is different to the one in Terminal, in this case you can try to edit **Environment Variables** in the file watcher and add a custom value for `PATH` that will contain `ruby` executable. – CrazyCoder Apr 02 '13 at 10:24
  • I just tried what your advice but I couldn't get it to work. I added the following in **Settings >> Path Variables** ruby : /home/tsega/.rvm/rubies/ruby-1.9.3-p194/bin/ruby . I also did the same thing in **Settings >> File Watchers** of my SCSS file watcher config's. but to know avail. I'm not sure if I'm doing the right thing here. – tsega Apr 02 '13 at 10:55
  • 3
    You are doing it wrong, define `PATH` variable with a value set to `/home/tsega/.rvm/rubies/ruby-1.9.3-p194/bin` . – CrazyCoder Apr 02 '13 at 11:06
  • I needed two values: /Users/[my-user]/.rvm/rubies/ruby-1.9.3-p327/bin: /Users/[my-user]/.rvm/gems/ruby-1.9.3-p327/bin Thanks! – poshaughnessy Sep 04 '13 at 14:14

2 Answers2

9

The problem is that IDE is not able to find ruby in the PATH. Note that it may be different in terminal and in applications that you start from Ubuntu launchpad.

Use the Environment variables option in the file watcher configuration to specify custom PATH value with a directory containing the required executables.

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
  • Can you give details about this? Im trying use webstorm on ubuntu 13.x but i cant figure out. I added path variables but it doesnt work. – the_bluescreen Oct 19 '13 at 17:39
  • Path Variables is not related to this, add `PATH` to the Environment Variables field of the file watcher. – CrazyCoder Oct 19 '13 at 17:40
  • It has nothing to do with being Ubuntu newbie, just do what is written, add `PATH` variable and set it to the list folders with the binaries that file watcher cannot find by default separated with `:`. – CrazyCoder Oct 19 '13 at 17:44
7

A quote from an answer/comment before:

"[...] ... just do what is written, add PATH variable ... [...]"

... That's exactly a common misunderstanding between helping people (who are mostly not teachers), who do the tasks on a daily basis, and asking people on the other hand, who can imagine 3 different things behind standartized answers and their words. Stackoverflow should extend on this, not repeat manuals or documentations.

In PHPstorm for example, you have 2 empty fields after hitting the plus on the right corner of the Enviroment variable settings window. The left field has the header "Variable", the right field the header "Value". So, if somebody is not familiar with PATH and ENVIROMENT variables of desktop or server systems, this person will be slidely confused about what has to be placed in the first field. Is it "ruby"? Is it "PATH"? Wouldn't it override the whole PATH variable of the system? Is it a custom given NAME I can choose and how does the system knows about it? No explanation can be found.

If you don't know the logic behind, you cannot assume the right steps from this standart formulated advice. While I am very excited about the feature set of PHPstorm I find the documentation slidely too standartized and unexplainable. Thats why many entries have bad votes from readers below. Like if somebody would ask: "how do I bake bred?" and the answerer says: "First you have to prepare flour and create dough, then you can bake bred." So what do the asker has learned from this answer? Exactly. Nothing what he didn't knew already before. Ok, maybe the question was not clear enough, but this is also a common case: how to ask correctly if you don't know what you actually ask for? From where can the person know, that there is a need to understand how to set PATH variables? I think this is what differs between makers and teachers. Teachers learn to communicate that gap. Documentation often lacks of better teachers writing it. People who work in the support team should be better in thinking like teachers.

To become more constructive: The documentation of PHPstorm says in its example: "choose PATH_TO_LIB as NAME and the path to the library for the VALUE field." Again: from where does this PATH_TO_LIB comes? Is it an own given Name, or a prepared empty VARIABE name PHPstorm watches? If something wents wrong and you start to look for issues which may cause this and start to worry about wrong settings you are lost on this questions even as an experienced PHP developer.

I generally prefer using tools like guard and RVM based ruby installations ATM over build in watch file solutions like these from PHPstorm, which mostly look for a system wide ruby and such first. But with rvm we have project based paths to ruby and such. RVM prevents breaking the compiling-chain of long term theme or module developments based on certain gem versions. Watch here http://www.youtube.com/watch?v=CmTuvzbPduI where Sebastian Siemssen (well known Drupal developer) explains why this is a good concept. But to nicely implement this with PHPstorm features, you need a better low level entry to path editing in PHPstorm.

Sadly this involves pressing save again, since this needs the save file event to be triggered. I would love to see a better implementation, flexibility and better explanation of how to go with the PHPstorm in-build watchers to have a refresh on edit at hand.

nilsun
  • 205
  • 2
  • 8
  • 2
    I can't agree more on your assessment on spitting out documentation vs elaborating to help people. Unfortunately, it's a result of the stackoverflow culture of pushing for conciseness, and overzealously removing redundancies. Unfortunately this comes at the cost of helping people especially people who are new – 1mike12 Feb 16 '15 at 17:59