0

I installed Ruby + Rails and its dependencies on a fresh installation of Ubuntu 14.04 using the following commands,

Pre Install Checklist

sudo apt-get update sudo apt-get upgrade

Add apt repositories from the Brightbox site.

sudo apt-get install software-properties-common
sudo apt-add-repository ppa:brightbox/ruby-ng
sudo apt-get update

sudo apt-get install ruby2.2 ruby2.2-dev
sudo apt-get install ruby-switch
sudo apt-get install bundler
sudo ruby-switch --set ruby2.2

ruby -v

Install Other Dependencies

sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev 
libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev 
libcurl4-openssl-dev python-software-properties libffi-dev

Install MySQL

sudo apt-get install mysql-server mysql-client libmysqlclient-dev

Install ImageMagick

sudo apt-get install imagemagick

Install Rails

gem install rails --no-rdoc --no-ri

Install SublimeText

sudo add-apt-repository ppa:webupd8team/sublime-text-3
sudo apt-get update
sudo apt-get install sublime-text-installer

Create a new app

mkdir projects
cd projects
rails new testapp
cd testapp

Open project in sublime text

subl -n .

Run rails server

bin/rails server



I didn't get any error during installation but when I ran the command bin/rails server it gave me the following error

Ignoring json-1.8.3 because its extensions are not built.  Try: gem pristine json --version 1.8.3
Warning: Running `gem pristine --all` to regenerate your installed gemspecs (and deleting then reinstalling your bundle if you use bundle --path) will improve the startup performance of Spring.
/var/lib/gems/2.2.0/gems/execjs-2.5.2/lib/execjs/runtimes.rb:48:in `autodetect': Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
    from /var/lib/gems/2.2.0/gems/execjs-2.5.2/lib/execjs.rb:5:in `<module:ExecJS>'
    from /var/lib/gems/2.2.0/gems/execjs-2.5.2/lib/execjs.rb:4:in `<top (required)>'
    from /var/lib/gems/2.2.0/gems/uglifier-2.7.1/lib/uglifier.rb:3:in `require'
    from /var/lib/gems/2.2.0/gems/uglifier-2.7.1/lib/uglifier.rb:3:in `<top (required)>'
    from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:72:in `require'
    from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:72:in `block (2 levels) in require'
    from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:70:in `each'
    from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:70:in `block in require'
    from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:59:in `each'
    from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:59:in `require'
    from /usr/lib/ruby/vendor_ruby/bundler.rb:132:in `require'
    from /home/arif/projects/testapp/config/application.rb:7:in `<top (required)>'
    from /var/lib/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:78:in `require'
    from /var/lib/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:78:in `block in server'
    from /var/lib/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `tap'
    from /var/lib/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `server'
    from /var/lib/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /var/lib/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands.rb:17:in `<top (required)>'
    from /home/arif/projects/testapp/bin/rails:8:in `require'
    from /home/arif/projects/testapp/bin/rails:8:in `<top (required)>'
    from /var/lib/gems/2.2.0/gems/spring-1.3.6/lib/spring/client/rails.rb:28:in `load'
    from /var/lib/gems/2.2.0/gems/spring-1.3.6/lib/spring/client/rails.rb:28:in `call'
    from /var/lib/gems/2.2.0/gems/spring-1.3.6/lib/spring/client/command.rb:7:in `call'
    from /var/lib/gems/2.2.0/gems/spring-1.3.6/lib/spring/client.rb:26:in `run'
    from /var/lib/gems/2.2.0/gems/spring-1.3.6/bin/spring:48:in `<top (required)>'
    from /var/lib/gems/2.2.0/gems/spring-1.3.6/lib/spring/binstub.rb:11:in `load'
    from /var/lib/gems/2.2.0/gems/spring-1.3.6/lib/spring/binstub.rb:11:in `<top (required)>'
    from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/arif/projects/testapp/bin/spring:13:in `<top (required)>'
    from bin/rails:3:in `load'
    from bin/rails:3:in `<main>'

I'm badly stuck, please help me !

1

As you probably have noticed, this is due to a JRE error. Make sure you have the following entries in your gem file:

gem 'execjs'
gem 'therubyracer', :platforms => :ruby

I have seen posts in SE where users were able to solve this issue by installing nodejs. To do this, in your terminal run:

sudo apt-get install nodejs

  • Yes, it worked :) But still its giving me this warning " Ignoring json-1.8.3 because its extensions are not built. Try: gem pristine json --version 1.8.3 Warning: Running gem pristine --all to regenerate your installed gemspecs (and deleting then reinstalling your bundle if you use bundle --path) will improve the startup performance of Spring. " – Bangash Jun 9 '15 at 9:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.