rubyjs / therubyracer

Embed the V8 Javascript Interpreter into Ruby
1.66k stars 191 forks source link

console not work #332

Closed zetachang closed 9 years ago

zetachang commented 9 years ago

console object is not defined in the evaluation context. Is this a designated behavior or a bug?

assimovt commented 9 years ago

I might be having the similar issue on Alpine Linux. After adding therubyracer to my Gemfile the rails command breaks with unknown usage error. Removing it, works again. Anyone having the same problem?

bash-4.3$ rails s
bin/rails:6: warning: already initialized constant APP_PATH
/tmp/test/bin/rails:6: warning: previous definition of APP_PATH was here
Usage: rails COMMAND [ARGS]

The most common rails commands are:
 generate    Generate new code (short-cut alias: "g")
 console     Start the Rails console (short-cut alias: "c")
 server      Start the Rails server (short-cut alias: "s")
 dbconsole   Start a console for the database specified in config/database.yml
             (short-cut alias: "db")
 new         Create a new Rails application. "rails new my_app" creates a
             new application called MyApp in "./my_app"

In addition to those, there are:
 destroy      Undo code generated with "generate" (short-cut alias: "d")
 plugin new   Generates skeleton for developing a Rails plugin
 runner       Run a piece of code in the application environment (short-cut alias: "r")

All commands can be run with -h (or --help) for more information.
cowboyd commented 9 years ago

@zetachang This is by design. console is a host object which, as it so happens, is provided by both node.js and the browser. It is not, however, part of JavaScript and so if you need it, you'll have to implement it with a Ruby object.