Ruby on rails installing error on Ubuntu - ruby-on-rails

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?

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

Rails 4.0 needs RubyGem version 2.0.3, update your rubygem
gem update --system 2.0.3

Related

Rails server not running after updating to ruby 2.1.4

I was using rails 4.1.7 with ruby 2.0.0 and have developed an application.
Recently upgraded to ruby 2.1.4 and made that as "Local" setting using rbenv. Now after doing "gem install rails", everything installed well.
Question is now if I try to run server, i am getting error
"Could not find rake-10.4.0 in any of the sources
Run bundle install to install missing gems."
bundle show rake reveals that its installed under
"bundle show rake
/Library/Ruby/Gems/2.0.0/gems/rake-10.4.0"
Shouldn't this be under 2.1.4?
Use rvm or rbenv to change ruby and gem space to another one. If you will begin usage of the them do the following (NOTE: If you already use one of them, just begin with point 2):
Install rvm with ruby:
$ \curl -sSL https://get.rvm.io | bash -s stable --ruby
or install rbenv, and then install ruby, and make it global:
$ \curl https://raw.githubusercontent.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash
$ rbenv install 2.1.4
$ rbenv global 2.1.4
Enter to the project, create two files .ruby-version with just installed version of ruby (in example 2.1.4), and .ruby-gemset with name of your project:
$ cd project-folder
$ echo "2.1.4" > .ruby-version
$ echo "your-project-name" .ruby-gemset
Fix Gemfile with newly intsalled version of ruby adding a line:
ruby '2.1.4'
Reenter to the project folder, and rvm will generate its wrappers:
$ cd .. ; cd project-folder
Issue gem installation:
$ bundle install

Installing rails. Gem install rails stucks (for real!), and curl stucks

:)
I am trying to install ruby on rails on VirtualBox. I started with Fedora... without success, now I am giving Ubuntu a try, and still some problems occur. I wrote:
$ gem install rails
$ gem -V install rails
$ gem update --system
I waited... but nothing happend. Then i tried diffrent approach and I wanted to install RVM... but then
$ curl -L get.rvm.io | bash -s stable --ruby
stucked... It downloaded 1 file... and that was it.
Any hint?
oh... to install ruby on rails i followed this way:
$ sudo apt-get install ruby1.9.1
$ wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.24.tgz
$ tar zxvf rubygems-1.8.24.tgz
$ cd rubygems-1.8.24
$ sudo ruby setup.rb
$ sudo apt-get install ruby1.9.1-dev
$ gem install rails
And I can't go any further than this...
Try using rbenv instead of rvm, bit simpler for a start.
rbenv + ruby-build is a must ;)
rbenv install ruby
gem install bundler
gem install rails
Maybe your OS has already a ruby installed and its interfering...
try :
which ruby
to find out.
Can't tell you more without nknowing more. :s
Good luck !

Ubuntu Installation Error

I had used below mentioned commands to install rails in ubuntu 12.10
sudo apt-get update
sudo apt-get install curl
\curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
rvm install 1.9.3
rvm use 1.9.3 --default
rvm rubygems current
gem install rails
Every steps are doing good, but it works for terminal which we are installing rails. If we exit from the terminal and work on a new terminal then the following error occurs.
The program 'rails' can be found in the following packages: * rails * ruby-railties-3.2 Try: sudo apt-get install
I came through a solution that whenever I open an terminal I would run these cmd
source ~/.rvm/scripts/rvm rvm --default use 1.9.3-p374
Can any one explain why these things happen??
Did you include the init script into your bash_profile/bashrc?
RVM installed by Ruby not working?
I've installed Rails 3.2.9 on my machine with RVM. You can follow this steps:
Install RVM : \curl -L https://get.rvm.io | bash -s stable
Reload shell configuration & test: source ~/.rvm/scripts/rvm
Install Ruby via RVM: rvm install 1.9.2 or rvm install 1.9.3
Choose version Ruby after install: rvm use 1.9.2 or rvm use 1.9.3
Ruby 1.9.2 and 1.9.3 support gem 1.8.25, so you'll install rails: gem install rails -v 3.2.9.
Done.
Note
Reload shell: source ~/.rvm/scripts/rvm and choose version Ruby rvm use 1.9.2 before work with projects.

Trouble installing rails in Mac OS 10.8.3

I'm trying to install RoR following railstutorial.org which is pretty similar to this one: http://www.creativereason.com/how-to-install-ruby-on-rails-mountain-lio.html
But, when i type "gem install rails" in command, i'm getting this error and couldn't install RoR.
I'm getting this error:
ERROR: Could not find a valid gem 'rails' (>= 0) in any repository
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
too many connection resets (http://production.s3.rubygems.org/latest_specs.4.8.gz)
Does someone know how to fix this and install rails correctly?
Install RVM and ruby:
$ curl -L https://get.rvm.io | bash -s stable --ruby
Then Rails:
rvm gem install rails
Another possibility is that rubygems is out of date:
gem install rubygems-update
and/or
gem update --system
I found the solution: I had to disable Avast antivirus! Now, it's working!

ERROR: Could not find a valid gem 'rails' (>= 0) in any repository

Trying to install rails 3.2.7.
Still stuck with the problems of rvm etc.
gem install rails
fetches me following :-
ERROR: Could not find a valid gem 'rails' (>= 0) in any repository
How can I get rails 3.2.7 up and working in my system?
gem sources should at least contain https://rubygems.org. If not
gem sources -a https://rubygems.org
should help.
Use rvm gem install rails
I just did it and it worked for me.
If you don't have rvm, then:
If you don't have ruby:
Install RVM and ruby:
$ curl -L https://get.rvm.io | bash -s stable --ruby
or
Additionally with rails:
$ curl -L https://get.rvm.io | bash -s stable --rails

Resources