Getting coffeescript to compile... how do you set it up?

Some documentation about how to set it up so it can compile would be nice…

The help files say

For executing CoffeeScript files, you need Node.js utility to be downloaded and installed on your machine.
Refer to usage instructions:

The usage instructions are... somewhat less then useful. I have coffee.exe compiler in path, and the latest version of coffeescript.js with it...
So... I have done everything it says to do... however... still nothing...

Idealy, I would like to be able to run .coffee files directly (and have Idea compile it in the background)

There is nothing in the Run/Debug windows around it… nothing in the compiler options in settings… just a whole world of nothing...
What you need to do to get Idea to compile / run it?

Also is there any chance of getting Node.js and compiler put in the plugin? or at least a setting somewhere where I can point Idea to the compiler, and have it work its magic from there?

Comment actions Permalink

Hello Blair,

As I understand you are Windows user, so you could install NodeJS for Windows (installer is here: Next step is to download CoffeeScript binaries, you could do it from here: (just extract the archive and rename extracted folder to “coffeescript”). Then if you want to run .coffee file from command line you should create coffee.cmd file with content like this:

@echo off

"C:\Program Files (x86)\nodejs\node.exe" "C:\Program Files (x86)\coffeescript\bin\coffee" %*

Then add it to the PATH environment variable. Now you can run CoffeeScript file by this way:


If you would like to run .coffee files from IntelliJ IDEA, you should install NodeJS plugin (go to Settings, select “Plugins” and press button “browse repositories”, select plugin “NodeJS” and press “Download and Install” menu item from context menu). Then add a new NodeJS  run configuration, specify path to node.exe file, in “Node parameters” put path to CoffeeScript library (in my case it is "C:\Program Files (x86)\coffeescript\bin\coffee"), specify working directory and file to run. That’s all.

And by the way, IntelliJ IDEA can show you result of compilation of CoffeeScript file (you should open the context menu and click on the “Compile CoffeeScript File” menu item).

Comment actions Permalink

It now kinda works (somewhat)! Took a lot of mucking around even after getting the instructions (which I would not have been able to get there without!).

I have the compile context menu, and that compiles to coffeescript which is a good start :)

I don't plan on using coffeescript for Node, just as a better way of producing js for html work (with couchdb in the background serving up data, and spine.js in the front end)
Though it is nice to be able to use some directly and see the output while I'm learning to write it.

I have NodeJS being able to run the .coffee file once I got your hint...

"Then add a new NodeJS  run configuration, specify path to node.exe file, in “Node parameters” put path to CoffeeScript library (in my case it is "C:\Program Files (x86)\coffeescript\bin\coffee"), specify working directory and file to run. That’s all."

But the setup seems pretty screwy, I'm not sure how people are meant to work that out...

Path to Node: points to the node.exe - fine :)
Node Parameters: "C:\Program Files\coffeescript\bin\coffee" - so... in the parameters we point node to the javascript file we want it to run?
Path to Node App JS File: - This is where your .coffee file goes, even though this isn't the node App Js file?
Working Directory: your project directory - fine :)

Since --watch doesn't work on windows (using Node), I'll have to run the compile every time, AND I need a seperate run/debug configuration for every file which makes it sort of unusable.... (weirdly enough... coffee.exe's --watch does work... which is weird....)

I'll try installing cygwin and seeing if I can get any further running node from there.

My question is answered, but it would be nice if the ide could compile the files into javascript files itself (as it seems to be able to do compile without an issue).
I guess I'm just use to everything else in Idea working perfectly :)

--- Blair
Comment actions Permalink

in windows, I'm able to get coffee to watch by using the following command:

node C:\Program Files (86)\coffee\coffee -cw $ProjectFileDir$

(setup as an external tool...)

Comment actions Permalink

So it does :)

So others may follow, this is the setup I am now using.
Note: Node can't detect new files with watch, so if you add another coffee script file then restart the builder.

Comment actions Permalink

UPDATE: I've opened this question as a new post here:

I've followed the instruction here (including Blair's recommendations) and it does seem to be working but I never see any compiler errors in the run output window.  Window indicates "Process finished with exit code 1"  (1 means errors occurred).   If I run using the coffee.cmd file in a command window  I see the compiler errors.  Anyway to pipe the errors to the INTELLIJ run's output window? See attached image.  I'm using INTELLIJ 11.1.1.

idea coffeescript compile output.jpg

Message was edited by: James Garza


Please sign in to leave a comment.