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
Please sign in to leave a comment.
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'
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
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
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" :-)
After spending some time arount this issue, I realized that the problem is more general and can be described like this:
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.
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.
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 :-)