CoffeeScript on Windows?

WindowsCoffeescript

Windows Problem Overview


How can I try CoffeeScript on Windows?

The installation instructions are only for *nix: http://jashkenas.github.com/coffee-script/#installation

EDIT:

Since I asked this a while ago, many new answers have appeared. The number ( and quality ) of options for Windows users has been increased a lot. I "accepted" an answer a long time ago, then changed to other ( better ) answers as they came up, but I have now decided to not accept any answer, and let the community ( votes ) show which answers are best. Thanks to everyone for the input.

Windows Solutions


Solution 1 - Windows

UPDATE: See my other answer to this question, https://stackoverflow.com/questions/2879401/how-can-i-compile-coffeescript-from-net/3036538#3036538 for a far more accurate and up-to-date list of the current options.

CoffeeScript-Compiler-for-Windows works well.

Solution 2 - Windows

Maybe it was more complicated when this question was posted. But as of 2012, CoffeeScript is as easy to use on any platform. The instructions are the same for Windows, Mac, or Linux

  1. Install Nodejs from http://nodejs.org/
  2. Install CoffeeScript globally with the node package manager npm install -g coffeescript or locally npm install --save-dev coffeescript
  3. Write a script in your favourite text editor. Save it, say as hello.coffee
  4. Run your script coffee hello.coffee or compile it coffee -c hello.coffee (to hello.js)

Solution 3 - Windows

Node.js runs on Cygwin these days, so that's probably your best bet with getting CoffeeScript running on Windows. I'd try that first.

If you have a different preferred JavaScript runtime, you can probably use the prebuilt-compiler (extras/coffee-script.js). For example, if you include that script on a webpage, you can call

CoffeeScript.compile(code);

... to get back the compiled JavaScript string.

> UPDATE 2012-04-12: Cygwin is no longer needed to run Node on Windows. Microsoft > worked with Joyent through 2H 2011 to improve node's support for > Windows IOCP async IO. Node 0.6 was the first release of node to > natively support Windows.

Solution 4 - Windows

You can run the CoffeeScript compiler under good old Window Script Host (cscript.exe), a standard component on Windows since Windows 98. Admittedly I tried this a while back and it didn't work, but I tried again recently and now all the standard CoffeeScript tests compile just fine.

A bit of plumbing code using a *.wsf file and coffee-script.js is all you need. My code is on GitHub: https://github.com/duncansmart/coffeescript-windows

I blogged about it here: http://blog.dotsmart.net/2011/06/20/the-simplest-way-to-compile-coffeescript-on-windows/

Solution 5 - Windows

You can use jcoffeescript as a command-line solution.

It uses a Java-based javascript engine (Rhino) and wraps up the task of compiling coffee-script.js from the CoffeeScript project. This allows it to run the CoffeeScript compiler as a Java program.

The command to use (on Windows/Linux) looks like this:

java -jar jcoffeescript-1.0.jar < foo.coffee > foo.js

You will need to download & build the Java source code (use IntelliJ Community Edition to avoid downloading Ant) or a pre-built download for CoffeeScript v1.0.

I now use jcoffeescript in place of the Ruby solution (another answer here), because this allows me to keep up with the latest CoffeeScript version.

Solution 6 - Windows

You can use a command-line version of CoffeeScript by installing Ruby on Windows and then installing the CoffeeScript Gem.

After that, the command-line is available, for example, 'coffee bla.coffee' - to compile your CoffeeScript code down to JavaScript code.

The only disadvantage doing it this way (not using Node.js) is that the Ruby version of CoffeeScript is restricted to version 0.3.2 - the last version written in Ruby before it was moved over to Node.js.

*However, I still use the Ruby version of CoffeeScript in my current employment and my personal web page and I don't see much of a problem as this version of CoffeeScript is quite mature and most of the features listed on the CoffeeScript website can be used.

*striked out this last statement which was correct at the time but is becoming more incorrect every few days; CoffeeScript has now advanced a long way since 0.3.2 and is past 1.1

Solution 7 - Windows

There're already bunch of answers here, but let me add mine. I wrote a .NET library for compiling CoffeeScript on Windows.

As jashkenas suggested, I've used the pre-compiled extras/coffee-script.js file.
Together with the Jurassic JavaScript compiler I've wrapped it all up in a single library: CoffeeSharp

The library also ships with a commandline tool and a HttpHandler for ASP.NET web development.

Solution 8 - Windows

I've used this one: https://bitbucket.org/maly/coffeescript-win/zealots looks working well, althouth you need to manually need to update coffee.script from 0.95 to 1.0.1.

Solution 9 - Windows

Since node.js is now ported to Windows, this is actually pretty easy:

http://www.colourcoding.net/blog/archive/2011/09/20/using-coffeescript-on-windows.aspx

Solution 10 - Windows

If you want to use CoffeeScript in an ASP.NET application then you can use this HTTP handler to serve compiled CoffeeScript code.

Solution 11 - Windows

I haven't tried this myself yet, but it seems to be an answer. (I've downloaded and installed but not used it yet.)

There's an add-in for Visual Studio 2010 that adds CoffeeScript editing to VS (among other things).

It's called Web Workbench and is downloaded as a vsix. (i.e. can be downloaded from within the VS UI.)

Solution 12 - Windows

I'm only putting this in only as an answer to the more general implied question for "How can I try" tools that don't normally run on Windows or have yet to be ported. Use a virtual machine running a UNIX-like OS such as Linux or BSD.

Provided you have enough RAM and are willing to learn enough to get around, it will make trying open source software a lot easier. In the CoffeeScript case you can still do things like --watch on a shared folder and remain in Windows land most of the time. You also won't pollute your system with tools and services you try and don't buy into, which is handy if you do that a lot.

Solution 13 - Windows

Consider using Chocolatey to install http://chocolatey.org/packages/CoffeeScript on Windows.

(Installing Chocolatey : https://github.com/chocolatey/chocolatey/wiki/Installation)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNick PerkinsView Question on Stackoverflow
Solution 1 - WindowsliammclennanView Answer on Stackoverflow
Solution 2 - WindowsColonel PanicView Answer on Stackoverflow
Solution 3 - WindowsjashkenasView Answer on Stackoverflow
Solution 4 - WindowsDuncan SmartView Answer on Stackoverflow
Solution 5 - WindowsPandaWoodView Answer on Stackoverflow
Solution 6 - WindowsPandaWoodView Answer on Stackoverflow
Solution 7 - WindowsTom LokhorstView Answer on Stackoverflow
Solution 8 - WindowsD_GuidiView Answer on Stackoverflow
Solution 9 - WindowsJulian BirchView Answer on Stackoverflow
Solution 10 - WindowsliammclennanView Answer on Stackoverflow
Solution 11 - WindowsMike GaleView Answer on Stackoverflow
Solution 12 - WindowsjerseyboyView Answer on Stackoverflow
Solution 13 - WindowsAndreView Answer on Stackoverflow