Setting up a LESS file watcher in PHPStorm 6 using node.js on Windows?
Solution 1
That error tells us that PHPStorm is calling CreateProcess
, which can only start executables. It cannot run scripts/batch files, which is what lessc
is. (PHPStorm would have to use ShellExecute
for that.)
To work around this limitation, you'll have to specify the Node installation (C:\Program Files\nodejs\node.exe most likely) as the executable, and the arguments should probably be something like C:\Users\Jason\AppData\Roaming\npm\node_modules\less\bin\lessc $FileName$
Solution 2
- Change Program:
C:\Users\Jason\AppData\Roaming\npm\lessc.cmd
- Change Arguments:
--no-color $FileName$
- Apply
Image: https://dl.dropboxusercontent.com/u/4287697/2014-09-26_11h25_29.png
JasonMortonNZ
Currently working as a full-time web application developer at Tectonic. My programming interest include: PHP Go (lang) Linux server administration Laravel Javascript MVC frameworks Ansible
Updated on August 05, 2022Comments
-
JasonMortonNZ over 1 year
I'm a recent convert to PHPStorm and absolutely loving it. I'm trying to get the 'File Watcher' to work with my LESS code, and I want it to use the lessc command. I have node.js installed and the command 'lessc' works from the windows command prompt, but it doesn't want to work within PHPStorm.
Here is my configuration for the file watcher:
When the file watcher runs, I get this error appear continuously:
An exception occurred while executing watcher 'LESS'. Watcher is disabled. Fix it.: Cannot run program "C:\Users\Jason\AppData\Roaming\npm\lessc" (in directory "F:\Plan2Share_v1\public\css"): CreateProcess error=193, %1 is not a valid Win32 application
As soon as I enable the watcher again, it somehow disables and throws me the above error again. I'm very new to node.js and PHPStorm. Any direction on where I might be going wrong would be greatly appreciated.
EDIT: Following @josh3736 's direction. I now get his error in the Run console of PHPStorm.
"C:\Program Files\nodejs\node.exe" C:\Users\Jason\AppData\Roaming\npm\lessc F:\Plan2Share_v1\public\css\style.less C:\Users\Jason\AppData\Roaming\npm\lessc:2 basedir=`dirname "$0"` ^ SyntaxError: Unexpected token ILLEGAL at Module._compile (module.js:439:25) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) at node.js:901:3