Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReferenceError: console is not defined #26

Closed
sunaku opened this issue Feb 16, 2011 · 3 comments
Closed

ReferenceError: console is not defined #26

sunaku opened this issue Feb 16, 2011 · 3 comments

Comments

@sunaku
Copy link

sunaku commented Feb 16, 2011

I get an Barista::CompilationError on my app/coffeescripts/application.coffee file (which is not the culprit because I ran coffee -c on it successfully) with the following trace:

[Barista] Compiling all scripts for barista
[Barista] Compiling all coffeescripts
[Barista] Compiling application.coffee from framework 'default'
[Barista] There was an error compiling coffeescript from app/coffeescripts/application.coffee:

/tmp/coffee.js20110215-13685-14wc4ac:9
var CoffeeScript = this.CoffeeScript, print = console.log;
                 ^
ReferenceError: console is not defined
    at Object.<anonymous> (/tmp/coffee.js20110215-13685-14wc4ac:9:18)
    at Module._compile (module:384:23)
    at Module._loadScriptSync (module:393:16)
    at Module.loadSync (module:296:10)
    at Object.runMain (module:459:22)
    at node.js:196:8

In my app/views/layouts/application.html.haml file, I have:

= coffeescript_include_tag 'application'

What am I missing? Thanks for your consideration.

@netzpirat
Copy link

I had the same problem and did some investigation: The root cause for this issue is a bug in locating the node binary in ruby-coffee-script, that has been introduced in the last version by this commit.

You can work around this bug by simply configure the bin_path:

Barista.configure do |config|
    config.bin_path = '/usr/local/bin/node'
end 

@netzpirat
Copy link

I have filed an issue for ruby-coffee-script and sent a pull request that resolves this issue.

@sunaku
Copy link
Author

sunaku commented Feb 17, 2011

Thanks netzpirat. I tried upgrading to the newly released coffee-script 2.1.3 gem but the same error still occurs. Next I tried setting config.bin_path = 'node' as you suggested and that fixed the error for me.

With some more investigation, I found that I installed nodejs on my Ubuntu machine and then also made a newer local node.js installation via NVM. CoffeeScript was installed locally in my NVM build, but not in the system-wide Ubuntu installation. That was the root cause of those errors.

I uninstalled the system-wide nodejs and now the problem is fully solved!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants