0

I'm on Windows 7, and I use a simple local build process that involves running node with Twitter RECESS and less.js to compile LESS to css on the fly.

Typically I just open cmd and type: lessc --compile stylesheet.less > stylesheet.css and it compiles the css no problem. Sometimes I use recess --compile, and sometimes I do --watch, but it works pretty much the same. I've been doing variations of this for months without a problem.

Today, something I did caused cmd to start opening the program associated with .less files every time a run a command. So when I type lessc --compile stylesheet.less > stylesheet.css it doesn't compile the .css file, it opens Sublime Text. I know nothing about Windows command prompts, and although I've spent the last two hours searching for an answer to this on google and SO, I'm not even sure I even know the correct terms to search for the right answer.

EDIT: I tried first removing any association with .js files, and that didn't work. Windows Automatically associated .js files with Visual Studio and wouldn't allow me to choose no program at all, even through command prompt. Then I tried changing the default program for .js files from to Notepad just for the heck of it, and now Notepad opens when I run a command. So at least it fails faster, but it still fails.

In any case, file association isn't the problem, I (anyone) should be able to use cmd with node regardless of whatever file associations exist - because, after all you need both node and your file associations to work properly. To me it seems like Windows is simply ignoring node.js now. I've even tried reinstalling it to see if that works.

Thanks for

merv
  • 67,214
  • 13
  • 180
  • 245
jonschlinkert
  • 10,872
  • 4
  • 43
  • 50

3 Answers3

0

Try the assoc command to check the file association and disassociate if necessary. Use assoc /? to see the usage.

assoc .less=

will disassociate.

Either that or you have changed the binary (or added another binary with the same name earlier in the PATH) that now launches the GUI program.

Preet Kukreti
  • 8,417
  • 28
  • 36
0

Look at the commands ftype and assoc.

In this case, I think you want assoc <.yourfileext>=

which removes any association between the file extension .yourfileext and any associated program. Make sure you check first before you remove so you know how to put the association back if there is a mistake.

JimR
  • 15,513
  • 2
  • 20
  • 26
  • thanks for your reply, yeah I tried removing the association temporarily, but that doesn't resolve the issue. Also, even if this did temporarily fix the problem I still need the file associations. – jonschlinkert Jul 16 '12 at 04:57
  • 1
    @jonschlinkert: There are different types of associations, but as far as I know it involves digging around the registry to solve... There are edit, run and view associations that I can think of off the top of my head. See if you can find the one for "run" and change it. It's not something I completely understand, just something I've tripped over. – JimR Jul 16 '12 at 06:29
  • thanks I'll try that and report back on here if I find anything – jonschlinkert Jul 18 '12 at 00:22
0

This is actually known problem:

see here: https://github.com/gruntjs/grunt#installing-grunt here: https://github.com/gruntjs/grunt/blob/master/docs/faq.md and here: GruntJs 'grunt' cmd opens Visual Studio?

Community
  • 1
  • 1
jonschlinkert
  • 10,872
  • 4
  • 43
  • 50