hass_
hass_

Reputation: 63

Cant run rails server on ubuntu

I am working on ruby on rails,

I have made a project using

rails new proj -d mysql

and then I type

rails server

but get this error, whats the problem

/home/mani/.rvm/gems/ruby-2.1.2/gems/execjs-2.2.1/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/mani/.rvm/gems/ruby-2.1.2/gems/execjs-2.2.1/lib/execjs.rb:5:in `<module:ExecJS>'
        from /home/mani/.rvm/gems/ruby-2.1.2/gems/execjs-2.2.1/lib/execjs.rb:4:in `<top (required)>'
        from /home/mani/.rvm/gems/ruby-2.1.2/gems/uglifier-2.5.3/lib/uglifier.rb:3:in `require'
        from /home/mani/.rvm/gems/ruby-2.1.2/gems/uglifier-2.5.3/lib/uglifier.rb:3:in `<top (required)>'
        from /home/mani/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.2/lib/bundler/runtime.rb:76:in `require'
        from /home/mani/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
        from /home/mani/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.2/lib/bundler/runtime.rb:72:in `each'
        from /home/mani/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.2/lib/bundler/runtime.rb:72:in `block in require'
        from /home/mani/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.2/lib/bundler/runtime.rb:61:in `each'
        from /home/mani/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.2/lib/bundler/runtime.rb:61:in `require'
        from /home/mani/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.7.2/lib/bundler.rb:133:in `require'
        from /home/mani/Sites/proj/config/application.rb:7:in `<top (required)>'
        from /home/mani/.rvm/gems/ruby-2.1.2/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:79:in `require'
        from /home/mani/.rvm/gems/ruby-2.1.2/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:79:in `block in server'
        from /home/mani/.rvm/gems/ruby-2.1.2/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:76:in `tap'
        from /home/mani/.rvm/gems/ruby-2.1.2/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:76:in `server'
        from /home/mani/.rvm/gems/ruby-2.1.2/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
        from /home/mani/.rvm/gems/ruby-2.1.2/gems/railties-4.1.5/lib/rails/commands.rb:17:in `<top (required)>'
        from /home/mani/Sites/proj/bin/rails:8:in `require'
        from /home/mani/Sites/proj/bin/rails:8:in `<top (required)>'
        from /home/mani/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `load'
        from /home/mani/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `call'
        from /home/mani/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client/command.rb:7:in `call'
        from /home/mani/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/client.rb:26:in `run'
        from /home/mani/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/bin/spring:48:in `<top (required)>'
        from /home/mani/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `load'
        from /home/mani/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `<top (required)>'
        from /home/mani/Sites/proj/bin/spring:16:in `require'
        from /home/mani/Sites/proj/bin/spring:16:in `<top (required)>'
        from bin/rails:3:in `load'
        from bin/rails:3:in `<main>'

Upvotes: 0

Views: 209

Answers (3)

user3252359
user3252359

Reputation:

sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison nodejs subversion

Then restart your machine.

Upvotes: 0

Nithin
Nithin

Reputation: 3699

You can do this on your system

sudo apt-get install nodejs

Upvotes: 0

RAJ
RAJ

Reputation: 9747

Add following gems in your Gemfile:

gem 'execjs'
gem 'therubyracer'

Run bundle install and now try to start rails server rails s

Upvotes: 4

Related Questions