3
votes

I'm actually trying to recompile the CoffeeScript compiler made in CoffeeScript from the github repository, but I cannot recompile a single coffee source file.

I tried to install coffee compiler with npm, but it gaves me a coffee command that does this when I try to run:

coffee src/lexer.coffee

Or:

coffee -c src/lexer.coffee

Error: In lexer.coffee, Parse error on line 115: Unexpected '...'
at Object.parseError (/usr/lib/coffee-script/lib/coffee-script/parser.js:477:11)
at ...
[Long stacktrace here]

So how could I try to run directly a compiler present on github repository ? When I try to run bin/coffee or bin/cake executables scripts, even in root mode or with nodeJS, they print nothing and return 1.

2
Why do you want to recompile the compiler ? - Emrys Myrooin
And it's written in the documentation that you need to run coffee -c path/to/source.coffee. In your question you've forgot the -c argument I don't know if it's a mistake you'v done in the terminal. - Emrys Myrooin
@EmrysMyrooin I've tried with and without -c flag. I updated my question to avoid misunderstandings. - Aracthor
What do you get when you run coffee -v and node -v? - Chris Kent
coffee -v and node -v both print nothing and still return 1. The same when I go into the cloned coffeescript repository and try to run ./bin/coffee -v - Aracthor

2 Answers

1
votes

Both

When I try to run bin/coffee or bin/cake executables scripts, even in root mode or with nodeJS, they print nothing and return 1.

and

coffee -v and node -v both print nothing and still return 1. The same when I go into the cloned coffeescript repository and try to run ./bin/coffee -v

Indicate that nodejs is not correctly installed. (Or at least not installed as coffeescript expects). On some Linux installations another application can be installed as node and this can conflict with scripts that expect node to be nodejs. See related question: nodejs vs node on ubuntu 12.04

1
votes

Are you missing cake? Looking at the CoffeeScript source, it appears that it is using cake as its build tool.

Unless I am missing something, the instructions in the README are not accurate in regards to building the project.

I was able to get the compiler to build by following these steps:

  1. Clone the CoffeeScript repo.
  2. Run npm install from the root of the CoffeeScript repo to install necessary dependencies.
  3. Install cake: npm install cake (I hate personally dislike globally installing, so I always just install the deps local to the project.)
  4. Run cake build: ./node_modules/.bin/cake build
  5. If no error, make sure the tests passed: ./node_modules/.bin/cake test
  6. Profit!

I am opening a PR right now to get these instructions updated in the README.

EDIT: Opened a PR for this: https://github.com/jashkenas/coffeescript/pull/4031