ruby on rails install help - ruby-on-rails

So I run this command successfully: sudo gem install rails
It outputs: Successfully installed rails-3.0.10
However, whenever I type in rails -v it shows: Rails 1.2.6
How can this be? Whenever I create a new project and do rails server, localhost:3000 doesn't work.

It's likely that your system has rails preinstalled, and the rubygems version is not overriding it.
You might have luck installing rvm and then installing rails within an rvm gemset.

Related

Ubuntu not detecting Rails installation

I recently reinstalled Ubuntu 12.04 after the upgrade package broke my last install. I've been following this walkthrough to restore Rails and continue working on my existing projects. I've already installed rvm, all the packages listed by rvm requirements, and all my development tools (e.g., vim, git, etc.).
However, I get stuck on the rails command, whether I'm trying rails (n,s,g), and returns the error message
$ rails
The program 'rails' is currently not installed. You can install it by typing:
sudo apt-get install rails
I've already done the following:
$ gem install rails
Successfully installed rails-3.2.3
1 gem installed
But based on the following checks, it still hasn't installed.
$ which gem
/home/eyoung/.rvm/bin/gem
$ which ruby
/home/eyoung/.rvm/bin/ruby
$ which rails
(no output)
I'm at my wit's end; any ideas on what's going on?
Extra details:
OS: Ubuntu 12.04 x86_64
Packages: RVM installed Ruby 1.9.3p194 w/ openssl & Rubygems
ruby and gem are on the system $PATH
EDIT: By request,
$ gem list rails
*** LOCAL GEMS ***
rails (3.2.3)
As rails gem was installed and all the other paths look correct, you need to set rvm to use that ruby as your default version. It will set all the paths correctly so you can use your gems and rails command.
rvm use 1.9.3 --default
I updated to 12.04 as well, and ran into the issue as well. After quite a bit of head scratching, I decided to reinstall rvm.
Referencing a previous question.

Messed up Rails installation (OS X)

I had already installed rails 1.8.7, forgot about it, then installed 1.9.3 through RVM. I was getting weird errors, so I purged my Mac of the system version of Ruby and started again using RVM. So far I've
Installed Ruby:
rvm reinstall 1.9.3-p0
which ruby
/Users/User/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
Manually setup Rubygems
which gem
/Users/User/.rvm/rubies/ruby-1.9.3-p0/bin/gem
Tried to install rails
sudo gem install rails
Successfully installed rails-3.2.1
1 gem installed
gem list
rails (3.2.1, 3.2.0)
It says rails is installed, but which gem does not work, and when I try to use rails new I get:
-bash: rails: command not found
I'm definitely missing something here. The only explanation I can think of is that there are remnants of a previous ruby or rails install that's causing problems. Is there a way to start completely from scratch?
If you are using RVM, you should not use "sudo" when you install gems. That will install gems to your system ruby version (not on the RVM rubies).
First, set up default rvm ruby like
rvm use ruby-1.9.3-p0 --default
Then, install rails on it by running:
gem install rails -v=3.2.1
It's actually better to use gemsets so you can have different gems set for the same ruby version. Check here for more info.

Every time I close terminal rails defaults back to 2.3.5 from 3.0.3?

I'm going through the rails by example tutorial.
Its seems that every time I close terminal rails defaults back to 2.3.5 & I have to go through the process of installing 3.0.3 every time I open the terminal?
I installed rails using: $ [sudo] gem install rails --version 3.0.3
Has anyone experienced a similar issue? I've tried googling around and searching stack to no avail.
The problem is almost-assuredly RVM interpreting 2.3.5 as your default rails version in your default gem set. I ran into this problem myself when first experimenting with RVM. Try this:
rvm --default use 1.9.2 (or whatever you want your default ruby interpreter to be)
rvm gemset create rails-3.0.3
rvm use 1.9.2#arails-3.0.3 --default
gem install rails
That will:
Set your default ruby interpreter to the desired ruby version
Create a gemset for your Rails 3.0.3 install and make it your default gemset
Install rails
Once you close the terminal and open it back up, it'll load RVM's defaults, putting you back on Rails 3.0.3 again.
Try uninstalling the rails gem:
gem uninstall rails
If you are prompted to select a version, select 2.3.5 and leave the 3.0.3 version intact.
P.S: Are you using RVM? If not, I would highly recommend it.
I've had this problem using RVM, if you're using RVM do: $rvm 1.9.2 (or whatever ruby version you installed the rails 3 gem with).
Check the output of $ ruby -v when you seem to have access to rails3 and again $ ruby -v when you can only seem to get to v2.3.5. If it shows different versions of ruby then you most likley are using RVM.
#Ads If youre using RVM and you install rails using sudo like so
$ [sudo] gem install rails --version 3.0.3
youre doing it wrong. RVM depends on you using a ruby distro that was installed by RVM into your user directory. If youre using sudo, youre installing rails gem into your system-wide ruby.
So check that youre using the right ruby version by doing 'rvm info' and then do your 'gem install rails --version 3.0.3' without sudo

problem with rails instalation need 2.3.8 after installation still getting "rails -v" = "Rails 2.3.5"

I'm trying to setup clockingit but...
even after
gem install -v=2.3.8 rails
1 gem installed
i'm getting
rails -v
Rails 2.3.5
I need 2.3.8 to rake the gems for clockingit
help greatly apreciated
Try gem install -v 2.3.8 rails (no equal sign). You should also check if the version of Ruby on Rails installed through RubyGems is used at all. Maybe a version of Ruby on Rails installed through the package management of your operating system overlaps the version installed through RubyGems.
Try to use rvm. It is dead simple to deal with, and makes managing gems very easy. If you already on rvm, try to create another gemset
rvm gemset create new_gemset
and the try to install rails

Error putting Instant Rails on Windows 7

I am trying to get my Instant Rails working on my Windows 7 laptop.
The error I keep getting when trying to access my site files are:
c:/rails/ruby/lib/site_ruby/1.8/rubygems.rb:779:in 'report_activate_error'
RubyGem version error: rack<1.1.0 not~> 1.0.1> <Gem::LoadError>
from c:/rails/ruby/lib/ruby.site_ruby/1.8/rubygems.rb:214:in 'activate'
from c:/rails/ruby/lib/ruby.site_ruby/1.8/rubygems.rb:1082:in 'gem'
from c:/depot/vendor/rails/actionpack/lib/action_controller.rb:34
from c://rails/ruby/lib/ruby.site_ruby/1.8/rubygems/custom_require.rb:31 in 'gem_original_require'
etc...
I have intalled Rubygems 1.3.7 and they work fine and when I run the test it works and the gem env shows that the 1.3.7 has been installed correctly.
What can I do to get this working?
Any prompt help would be VERY appreciated.
Thanks
Your rack gem is outdated. Try to run gem update rack. Or, if you use Rails with Bundler, just run bundle install in the root of your project and it will do everything for you.
I decided to write a little manual about the Ruby 1.8.7 and Rails stable installation.
Download RubyInstaller 1.8.7 from here. During the installation, check the 'Add Ruby executables to your PATH' box. After the installation, don't forget to restard cmd. Then try running ruby -v and gem -v to check for installed Ruby 1.8.7 and RubyGems 1.3.7;
Install the latest stable Rails 2.3.8 using gem install rails --no-ri --no-rdoc; Check it using rails -v;
Create a new application using rails myapp;
Test it: script/server. That's it!
gem install rack -v 1.0.1

Resources