File watchers get disabled after "Fix it"

I'd like to use a file watcher for stylus and jade updates to my app.  When I make a change in either of these files I get a pop-up saying:

An exception occurred while executing watcher 'Stylus'. Watcher has been disabled. Fix it.: Cannot run program "C:\Users\Me\myDirectory\node_modules\stylus\bin\stylus" (in directory "C:\Users\Me\myDirectory\public\css"): CreateProcess error=193, %1 is not a valid Win32 application
"Fix it" is a link that I press to click on a checkbox to enable it. Then the error returns when I try it again.  It appears that the \bin\stylus file is a bash comand file and not an executable (I'm running Windows).


Similarly for jade I get this error:

An exception occurred while executing watcher 'Jade'. Watcher has been disabled. Fix it.: Cannot run program "C:\Users\Me\myDirectory\node_modules\jade\runtime.js" (in directory "C:\Users\Me\myDirectory\server\views\partials"): CreateProcess error=193, %1 is not a valid Win32 application.  This time it's expecting runtime.js to be an executable.

How do I get WebStorm to execute the proper files to watch my changes?

Thanks

7 comments
Comment actions Permalink

Hello!

you should have set the corresponding executables as programs.
For Stylus, it should be smth like 'C:\Users\User_name\AppData\Roaming\npm\stylus.cmd'
For Jade: 'C:\Users\User_name\AppData\Roaming\npm\jade.cmd'


Both executables are installed when you run 'npm install <pck_name> -g'

0
Comment actions Permalink

I just re-verified that neither .bat files exist as a consequence of "npm install jade stylus -g" command - with the caveat that I use Windows Server 2012 as my development environment. Using file watchers in Webstorm is a really nice feature and I do not want to give up on using it just because I cannot find jade.bat and stylus.bat

Can anyone help, please

0
Comment actions Permalink

Hmm.. what about cmd files?
Please try the following:
-  run 'npm config list' in Windows cmd console
- cd to a directory returned as 'prefix' value
- run 'ls' command there and provide the output

0
Comment actions Permalink

Just solved this "puzzle"  was preparing to write this explanation:

I installed nodejs several months ago and made it reside in c:\nodejs folder. This seems like a choice that others did not make so all of my other components installed using npm ended in that folder as well. This includes the files I was searching for (styles.cmd and jade.cmd) with additional caveat that I was looking for .bat files, not .cmd files.

Note that as a consequence of my choice for nodejs "home" directory none of your previous suggestions like ... appdata\roaming, Program Files (x86) apply. Probably, the best answer is "look in the nodejs home directory" :-)

0
Comment actions Permalink

After spending some time arount this issue, I realized that the problem is more general and can be described like this:

  1. Create a new WebStorm project and write a few jade files
  2. As these files are stored on disk, IDE offers to run the Jade watcher and you accept the offer
  3. Assuming that you installed Jade (via npm) the default Jade Watcher dialog may or may not be properly configured (in my case it was not, because my Jade installation was non-standard). As a consequence the Jade Watcher failed and reported the problem.
  4. It took me several attempts to fix the issue at hand, where the key realization was that the Jade.cmd file should invoke node.exe with the argment being the JavaScript file that will transpile the .jade code
  5. When I finally configured the watcher correctly, no matter what I tried to run the transpiler, I would never get the matching .html file



The workaround is simple and relatively painful: I had to delete all .jade files that already existed when I properly configured the watcher and enter them again.

This really begs for a simpler solution: force the transpiler to run at the time of user's convenience. I found several discussions around this idea, some statements that it will be / is available in PhpStorm 7 - but it does not seem to exist in WebStorm 7.0.3 that I am using.

0
Comment actions Permalink

It does exist. You can use  'Run file watchers' command for this: just select a file/folder, hit  Ctrl+Shift+A -> Ctrl+Shift+A to enable non-menu actions -> type  "run file " -> choose Run File Watchers.... You can assign custom  shortcut for "Plugins | File Watchers | Run File Watchers" action in  Settings | Keymap to make this procedure less complicated.

0
Comment actions Permalink

Perfect - in my search for this feature, I did find a similar description - except that it was a single Ctrl-Shift-A sequence which does not run the watcher. Like you advised, I will assign a simpler key sequence to activate the watcher.

Thank you Elena for such speedy and curteous help :-)

0

Please sign in to leave a comment.