KCH
KCH

Reputation: 2854

Coffeescript compilation fails for no apparent reason

When I try to compile this script (first.coffe):

some_object = 
  property_a : 123
  property_b : "hello"

I get following error:

In first.coffee, Parse error on line 2: Unexpected 'INDENT'

but when I use "try coffeescript" functionality of coffeescript website, everything seems to work fine, because output is exactly this:

var some_object;

some_object = {
  property_a: 123,
  property_b: "hello"
};

What am I doing wrong? I work on Ubuntu, so coffescript was installed from repositories.

Upvotes: 1

Views: 173

Answers (2)

Tom Livesey
Tom Livesey

Reputation: 411

It might have something to do with your text editor. I know I've had trouble before with indent settings and line endings. Try opening it up in a different editor if you are using VIM.

Upvotes: 2

oylenshpeegul
oylenshpeegul

Reputation: 3424

Ubuntu 11.10 has an up-to-date CoffeeScript package. Older versions of Ubuntu may have a CoffeeScript package that is too old. If you are using an Ubuntu older than 11.10, uninstall that package and install a newer CoffeeScript.

Upvotes: 1

Related Questions