user5584172
user5584172

Reputation:

Ruby on rails installing error on Ubuntu

I just tried to install rails by this command:

sudo gem install rails

but error occurs like this:

Building native extensions. This could take a while... ERROR: Error installing rails: ERROR: Failed to build gem native extension.

/usr/bin/ruby1.9.1 extconf.rb /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in 'require' from extconf.rb:1:in '<main>'

Gem files will reamin installed in /var/lib/gems/1.9.1/gems/json-1.8.3 for inspection. Results logged to /var/lib/gems/json-1.8.3/ext/json/ext/generator/gem_make.out

I tried several times reinstalling ruby and also triedsudo apt-get update

What should I do?

Upvotes: 1

Views: 188

Answers (2)

huzefa biyawarwala
huzefa biyawarwala

Reputation: 657

Just follow the below steps and you will be able to install rails easily on ubuntu :

First install rvm (I guess you have already installed) using the command :

$ \curl -L https://get.rvm.io | bash -s stable --ruby

Then install Ruby :

$ rvm install ruby
$ rvm --default use ruby-2.2.3

Then install Node.js for rails :

$ sudo apt-get install nodejs

And lastly , install rails by :

$ > gem install rails

You can check the version of rails installed using :

$ > rails -v 

I hope this helps.

Update:

As per @Amit sir's comment , We can use the below command which installs both , ruby and rails combined as :

\curl -sSL https://get.rvm.io | bash -s stable --rails

Upvotes: 3

DilumN
DilumN

Reputation: 2895

Rails 4.0 needs RubyGem version 2.0.3, update your rubygem

gem update --system 2.0.3

Upvotes: 0

Related Questions