Error starting "Rails Server"

Asked

Viewed 2,709 times

2

Hi I’m trying to install Ruby on Rails on Ubuntu and startar the server using the command

rails server

returns me the following error.

felipe@Dumont:~/mo$ rails server
/home/felipe/.rvm/gems/ruby-2.0.0-p481/gems/execjs-2.1.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/felipe/.rvm/gems/ruby-2.0.0-p481/gems/execjs-2.1.0/lib/execjs.rb:5:in `<module:ExecJS>'
    from /home/felipe/.rvm/gems/ruby-2.0.0-p481/gems/execjs-2.1.0/lib/execjs.rb:4:in `<top (required)>'
    from /home/felipe/.rvm/gems/ruby-2.0.0-p481/gems/uglifier-2.5.0/lib/uglifier.rb:3:in `require'
    from /home/felipe/.rvm/gems/ruby-2.0.0-p481/gems/uglifier-2.5.0/lib/uglifier.rb:3:in `<top (required)>'
    from /home/felipe/.rvm/gems/ruby-2.0.0-p481/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `require'
    from /home/felipe/.rvm/gems/ruby-2.0.0-p481/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from /home/felipe/.rvm/gems/ruby-2.0.0-p481/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `each'
    from /home/felipe/.rvm/gems/ruby-2.0.0-p481/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `block in require'
    from /home/felipe/.rvm/gems/ruby-2.0.0-p481/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `each'
    from /home/felipe/.rvm/gems/ruby-2.0.0-p481/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `require'
    from /home/felipe/.rvm/gems/ruby-2.0.0-p481/gems/bundler-1.6.2/lib/bundler.rb:132:in `require'
    from /home/felipe/mo/config/application.rb:7:in `<top (required)>'
    from /home/felipe/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:79:in `require'
    from /home/felipe/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:79:in `block in server'
    from /home/felipe/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:76:in `tap'
    from /home/felipe/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:76:in `server'
    from /home/felipe/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
    from /home/felipe/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.1.1/lib/rails/commands.rb:17:in `<top (required)>'
    from /home/felipe/mo/bin/rails:8:in `require'
    from /home/felipe/mo/bin/rails:8:in `<top (required)>'
    from /home/felipe/.rvm/gems/ruby-2.0.0-p481/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `load'
    from /home/felipe/.rvm/gems/ruby-2.0.0-p481/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `call'
    from /home/felipe/.rvm/gems/ruby-2.0.0-p481/gems/spring-1.1.3/lib/spring/client/command.rb:7:in `call'
    from /home/felipe/.rvm/gems/ruby-2.0.0-p481/gems/spring-1.1.3/lib/spring/client.rb:26:in `run'
    from /home/felipe/.rvm/gems/ruby-2.0.0-p481/gems/spring-1.1.3/bin/spring:48:in `<top (required)>'
    from /home/felipe/.rvm/gems/ruby-2.0.0-p481/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `load'
    from /home/felipe/.rvm/gems/ruby-2.0.0-p481/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `<top (required)>'
    from /home/felipe/mo/bin/spring:16:in `require'
    from /home/felipe/mo/bin/spring:16:in `<top (required)>'
    from bin/rails:3:in `load'
    from bin/rails:3:in `<main>'

Could someone please let me know a solution to this problem? I’m a new Linux user.

  • Dude I also advise you to use Nodejs: sudo apt-get install nodejs

2 answers

2


First open your terminal and access the folder of your project and gives a bundle install or installs the gem install uglifier. Besides that Rails needs Nodejs installed on the machine to run the javascript engine, with the command sudo apt-get install nodejs

1

Certain actions that Rails does require a Javascript engine to be installed on the operating system. This includes compiling files Coffeescript and Sass, for example.

  • Try to install the The Ruby Racer adding gem "therubyracer", platforms: :ruby in your Gemfile and run bundle install

  • If it doesn’t work try to install the Nodejs: sudo apt-get install nodejs

  • 2

    It is recommended to use nodejs, the ruby racer has a series of the problems.

  • I believe that the best option is to install the nodejs anyway! Already not to have these future problems!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.