Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Could not find a JavaScript runtime #31

sheldonh opened this Issue · 23 comments

Targetting rails-3.1.0.rc2, I tried using a railswizard with the following recipes:

  • Cucumber
  • Git
  • Mongoid
  • RSpec
  • SASS

The generate commands all failed because execjs was unable to find a JavaScript runtime. For example:

Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
wizard    Running after Bundler callbacks
generate  cucumber:install --capybara --rspec -D
.../gems/execjs-1.1.1/lib/execjs/runtimes.rb:43:in `autodetect': Could not find a JavaScript runtime. See for a list of available runtimes. (ExecJS::RuntimeUnavailable)

I worked around this by

  • deleting the new app,
  • installing therubyracer --pre,
  • running the railswizard-assisted rails new app command again,
  • adding therubyracer to the Gemfile in the generated app, and
  • running the failed targets (cucumber:install, mongoid:config, rspec:install) by hand.

check through this URL..I would be helpful.


My point is that the rails wizard probably needs to know what version of rails it's targetting, and add therubyracer for 3.1.


Thanks sheldonh! After fixing many many issues I couldn't figure out why rails worked perfect in my shell (fixed all issues with this original shell). But when opening new shells rails no longer worked. I would get the following error:

bash: /usr/bin/rails: /usr/bin/ruby1.8: bad interpreter: No such file or directory

Then after reading your last comment it hit me, so obvious. After installing and reinstalling rails so many times, I had forgotten to set 1.9.2 as my default with:

$ rvm use 1.9.2 --default


On my linux (ubuntu) the command

sudo apt-get install nodejs

did the job finally for me.


Thanks Banta, it works for me. (Ubuntu 11.04)




it works,great!


Install JavaScript runtime environment in your systems by using following steps. this is best way to sole

tar xfv node-v0.1.31.tar.gz
cd node-v0.1.31
make install

Jagat Singh


If nodejs and other fails to work you can you can start your rails command with bundle exec e.g

      bundle exec rails s
      bundle exec rake db:create
      ... etc



@Banta thanks!


being on this page
never once did he say anything about shutting coffee-script off. I know that it is possible but not well documented.
I do not have a javascript engine like nodejs and it ruins my restful experience with Rails. See error below from doing
Rendered users/index.html.erb within layouts/application (66.6ms)
Completed 500 Internal Server Error in 2853ms

ActionView::Template::Error (/usr/bin/js: 22: /usr/bin/java: not found

(in /home/kb9agt/My_Repositories_Github/rails_projects/demo_app/app/assets/javascripts/
4: DemoApp
5: <%= stylesheet_link_tag "application", :media => "all" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
app/views/layouts/application.html.erb:6:in _app_views_layouts_application_html_erb__189663113_74149310'
I will not use node.js because of this: 1.) Why is rails being so nosy with my system? I am a user not a system. It has no business needing anything from my system. Not even Ruby is at the system level as an rvm user.


To me too.... Thanks!


rubyracer gem is the answer for me. :-D


@DouglasAllen I'll have to try that out.




Looks like SheldonH used one of those Rmagic samples on himself there. :-D


Thanks Banta, installing nodejs worked


@DouglasAllen 11 months ago, dude.


sorry in which path we should type:
"$ gem install execjs"
I installed it every where but didn't work! :(


@sheldonh The RMagic or my comment? Close err up then. :+1:


Sure thing. We'll call it working as intended. :-)

@sheldonh sheldonh closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.