Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Could not find a JavaScript runtime #31

Closed
sheldonh opened this Issue · 23 comments
@sheldonh

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 https://github.com/sstephenson/execjs 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.
@dlamichhane

check through this URL..I would be helpful.

http://www.ruby-forum.com/topic/1899392

@sheldonh

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

@giftedwarrior

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

@Banta

On my linux (ubuntu) the command

sudo apt-get install nodejs

did the job finally for me.

@dagosi89

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

@rlishtaba

Thanks

@Azincourt

it works,great!

@j4jagat

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

wget http://nodejs.org/dist/node-v0.1.31.tar.gz
tar xfv node-v0.1.31.tar.gz
cd node-v0.1.31
./configure
make
make install

Thanks,
Jagat Singh

@Banta

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
@thiyagarajan

Thanks

@cue232s

@Banta thanks!

@DouglasAllen

being on this page http://ruby.railstutorial.org/chapters/a-demo-app?version=3.2#top
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
http://localhost:3000/users
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/users.js.coffee)):
3:
4: DemoApp
5: <%= stylesheet_link_tag "application", :media => "all" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8:
9:
app/views/layouts/application.html.erb:6:in _app_views_layouts_application_html_erb__189663113_74149310'
app/controllers/users_controller.rb:7:in
index'
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.
2.) http://teddziuba.com/2011/10/node-js-is-cancer.html

@thiagofalencar

To me too.... Thanks!

@DouglasAllen

rubyracer gem is the answer for me. :-D

@Banta

@DouglasAllen I'll have to try that out.

@yoniix

Thanks

@DouglasAllen

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

@Ganyobi

Thanks Banta, installing nodejs worked

@sheldonh

@DouglasAllen 11 months ago, dude.

@maryamii

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

@DouglasAllen

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

@sheldonh

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.