Ayrton Senna
Ayrton Senna

Reputation: 3835

Cannot run rails server

I am starting to learn Ruby on Rails but have been stuck at the basic installation part for 2 days now. I was following a tutorial which mentions starting the server with the rails server command.

Running this command, I get the following output:

$ rails server
/home/niranjan/.rvm/gems/ruby-1.9.3-p194/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
    from /home/niranjan/.rvm/gems/ruby-1.9.3-p194/gems/execjs-1.4.0/lib/execjs.rb:5:in `<module:ExecJS>'
    from /home/niranjan/.rvm/gems/ruby-1.9.3-p194/gems/execjs-1.4.0/lib/execjs.rb:4:in `<top (required)>'
    from /home/niranjan/.rvm/gems/ruby-1.9.3-p194/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'
    from /home/niranjan/.rvm/gems/ruby-1.9.3-p194/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `<top (required)>'
    from /home/niranjan/.rvm/gems/ruby-1.9.3-p194/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require'
    from /home/niranjan/.rvm/gems/ruby-1.9.3-p194/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `<top (required)>'
    from /home/niranjan/.rvm/gems/ruby-1.9.3-p194/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `require'
    from /home/niranjan/.rvm/gems/ruby-1.9.3-p194/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `<top (required)>'
    from /home/niranjan/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/runtime.rb:68:in `require'
    from /home/niranjan/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from /home/niranjan/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/runtime.rb:66:in `each'
    from /home/niranjan/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/runtime.rb:66:in `block in require'
    from /home/niranjan/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/runtime.rb:55:in `each'
    from /home/niranjan/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/runtime.rb:55:in `require'
    from /home/niranjan/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler.rb:119:in `require'
    from /home/niranjan/fourth_app/config/application.rb:7:in `<top (required)>'
    from /home/niranjan/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands.rb:53:in `require'
    from /home/niranjan/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands.rb:53:in `block in <top (required)>'
    from /home/niranjan/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands.rb:50:in `tap'
    from /home/niranjan/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

I have been having several different problems and I have done rvm implode and reinstall several times. I have the rvm scripts in the PATH variable.

$ rvm -v

rvm 1.15.7 (stable) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]

 $ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]


$ rails -v
Rails 3.2.8

I am using Linux Mint 12. Any help/suggestion would be appreciated.

Thanks

Upvotes: 2

Views: 4738

Answers (2)

Abhishek
Abhishek

Reputation: 1618

Try this, it worked for me

Add following lines in your 'Gemfile' (Placed in directory created for Rails project)

gem 'therubyracer'

gem 'execjs'

and run this command in your terminal

bundle install

Thats it..!! :)

Upvotes: 8

gerky
gerky

Reputation: 6417

Do you have a JS runtime? I think it's required from Rails 3.1 onwards (for the asset pipeline). Check out this article: Deploying a Rails 3.1 App Gotchas.

Try installing node.js.

It might also be related to this: ExecJS and could not find a JavaScript runtime

Upvotes: 3

Related Questions