Hopefully this is an easy one - I'm trying to install rails on my netbook. I can#'t seem to get it to update to rails 3 (seems stuck on 2.3.5). Here's some terminal output to show you what I mean...
mike#Ubuntu-Netbook:~$ rails -v
Rails 2.3.5
mike#Ubuntu-Netbook:~$ gem update rails
Updating installed gems
Nothing to update
mike#Ubuntu-Netbook:~$ sudo gem install rails
[sudo] password for mike:
Successfully installed rails-3.1.0
1 gem installed
Installing ri documentation for rails-3.1.0...
file 'lib' not found
Installing RDoc documentation for rails-3.1.0...
file 'lib' not found
mike#Ubuntu-Netbook:~$ rails -v
Rails 2.3.5
See? Stuck at 2.3.5! I have done a whole bunch of rails installs on other machines and never had this problem before - what am I missing?
The 2.3.5 install is completely working.
EDIT: I did not get an answer to this question. I got around it by investigating rvm and installing that way instead.
Are you using bundler? Are you in an rvm gemset?
If you're using the latter, once you sudo, you're in a different user's rvm install, so installation won't be the same. If you're using bundler and have locked rails to 2.3.5, that's what it'll be regardless whether you run gem update or not.
If you can answer the above two questions, we can probably narrow down your issue.
Related
Parsing documentation for bundler-1.3.2
Installing ri documentation for bundler-1.3.2
Parsing documentation for rails-3.2.12
Installing ri documentation for rails-3.2.12
Done installing documentation for i18n, multi_json, activesupport, builder, activemodel, rack, rack-cache, rack-test, journey, hike, tilt, sprockets, erubis, actionpack, arel, tzinfo, activerecord, activeresource, mime-types, polyglot, treetop, mail, actionmailer, rack-ssl, thor, rdoc, railties, bundler, rails (58 sec).
29 gems installed
204-252:~ narendra$ rails -v
Rails 2.3.8
204-252:~ narendra$ gem update rails
Updating installed gems**strong text**
Nothing to update
If you're using rbenv you can try running rbenv rehash after updating rails.
If you're in a rails project folder that was built with Rails 2.3.8 then when you run rails -v in that folder it will return that version of rails instead of the latest one. So you could try moving to another folder and see if running rails -v gives you the version you're expecting.
Also, if you installed rails with sudo gem install rails sometimes /usr/bin/rails still points to the old version, so you could update that to point to the new one.
Since rails 3.2.12 is not included in the output of gem list, I suspect you installed the gem with sudo. Installing with sudo and then trying to list the gems without it (or other operations) can give you a different list. Try doing sudo gem list, and if rails 3.2.12 is in there, thats your problem. Try installing it without sudo.
I try to create new app with "rails new" command however getting this error:
'report_activate_error': Could not find RubyGem railties (>= 0) (Gem::LoadError)
from /usr/lib/ruby/vendor_ruby/1.8/rubygems.rb:244:in 'activate_dep'
from /usr/lib/ruby/vendor_ruby/1.8/rubygems.rb:236:in `activate'
from /usr/lib/ruby/vendor_ruby/1.8/rubygems.rb:1307:in `gem'
from /usr/local/bin/rails:18
Any idea why?
by the way I am working on Ubuntu
gem list
*** LOCAL GEMS ***
it is empty but I installed rails just before
I have encountered the issue before.The solution is :
you must use comand gem install rails, not sudo gem install rails.
I encountered the same problem and found the following solution Here which was mentioned here. Hope it helps
After you installed RVM and after you set the default Ruby version in RVM, you need to re-install all ruby gems, e.g.
gem install rails
you need to install those gems as the user, not as root.
Because from now on RVM will keep track of all installed gems by the ruby version which was used to install them!
You need to install RVM (I don't know it is the best solution but it works) then use such rails commands like rvmsudo rails new or such. I use rails and ruby command with including rvm or rvmsudo phase and all of them start to work.
Do you have multiple Ruby installations on your system? Maybe you have installed some package (like Heroku with full installation) and you are using the 'new' Ruby installation. I have uninstalled the last Ruby and everything seems to be fine.
Edit: Not everything is fine... yet. Under Windows you will have to edit Heroku.bat (in your Program Files/Heroku path) and change the path to Ruby installation folder.
Install rvm and try it again to install rails
RVM provides a very great way to manage your gems in Gemsets
for multible ruby installations.
On the offizial rvm site is a installation tutorial
http://beginrescueend.com/
I am trying to install Ruby, RubyGems, and the Ruby on Rails framework so that it will play nicely with my system. I am having issues with my installation. Could somebody help me? Here are the details of my system and how I went about installation.
Currently I am running ubuntu 10.10 using the Linux Kernel 2.6.35-28-generic. My server is Apache 2.2.16 and I use MySQL 5.1.49.
So, I went to my synaptic package manager and selected the following packages to download:
* ruby1.8 – installs Ruby 1.8.4
* libmysql-ruby – additional libraries to access MySQL
* libruby1.8-dbg – debugging library
* ri – Ruby Interactive Reference
* ruby1.8-dev – header files for building extensions
* rails – Ruby On Rails framework
Once that ran successfully, I downloaded rubygems from http://rubyforge.org/projects/rubygems/. Then I unpacked it, got in the terminal, ran a cd to get in the directory of the newly downloaded rubygems directory, and typed 'sudo ruby setup.rb' That ran with no problem and RubyGems 1.8.5 was installed. Then I ran 'sudo gem install rubygems-update' with no problem.
But when I ran 'sudo gem install rails –include-dependencies' I got the following output:
Fetching: activesupport-3.0.8.gem (100%)
Fetching: rails-3.0.8.gem (100%)
Successfully installed activesupport-3.0.8
Successfully installed rails-3.0.8
2 gems installed
Installing ri documentation for activesupport-3.0.8...
Installing ri documentation for rails-3.0.8...
File not found: lib
ERROR: While generating documentation for rails-3.0.8
... MESSAGE: exit
... RDOC args: --ri --op /var/www/testingwww/rubygems-1.8.5/nclude-dependencies/doc/rails-3.0.8/ri lib --title rails-3.0.8 Documentation --quiet
When I run 'rails -v' I get 'Rails 3.0.8' so it seems to have installed despite the error. But when I try to make a rails app by typing 'rails ./helloWorld' I get the manual page for the rails keyword.
I have looked around for two days now on how to fix this issue, but can't seem to figure it out. Does anybody know how to fix this?
Rails 3 requires version 1.8.7 or 1.9.2.
I'd recommend using RVM to manage your Ruby installation and environments. It will really help to get you going quickly and is simple. It's as simple as
curl -L https://get.rvm.io | bash
to install RVM and then rvm install 1.9.2 will get you going.
Have a look at https://rvm.io for more information.
In addition to Matthew's good Answer, I don't know why you're doing rails ./helloWorld. To generate a new app in Rails 3, you should do rails new helloWorld.
If you need a complete guide to getting rolling with Rails under Ubuntu, you can find a short guide here: http://blog.dcxn.com/2011/06/21/rolling-with-rails-3-on-ubuntu-11-04/
The gist is:
Install RVM (The Ruby version manager)
Install Rails from gem
Get going with Rails
It's a simple process but there are a few things you need to do for it to be completely smooth like making sure you have the pre-requisites for rvm installed via apt before install rvm.
Good luck!
I currently have rails 3.0.3 and am trying to download and use version 3.0.1. I've downloaded and installed RVM and inputted the following code in Terminal (I have a Mac OS X 10.6.5):
rvm use 1.8.7
rvm gemset create rails3.0.1
rvm 1.8.7#rails3.0.1
sudo gem install rails --version=3.0.1
I use sudo gems because of the user permissions, or my lack there of. Anyway, after I enter the last line of code: "sudo gem install rails --version=3.0.1" I get the following error:
Successfully installed rails-3.0.1
1 gem installed
Installing ri documentation for rails-3.0.1...
File not found: lib
Not only can I apparently not able to switch versions of rails, even though it appears as though I have multiple versions installed, every time I try to check to see what version of rails I currently have I get the following result:
rails -v
/Library/Ruby/Site/1.8/rubygems.rb:779:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
from /Library/Ruby/Site/1.8/rubygems.rb:214:in `activate'
from /Library/Ruby/Site/1.8/rubygems.rb:1082:in `gem'
from /usr/bin/rails:18
Also, I've already installed Rdoc and Xcode (I've done research and other suggestions pointed to installing both). I'm a RoR newbie, and especially an RVM newbie, so I would love an explanation and a solution to this madness.
Thank you for reading!
I think you went off the rails (ha-ha) right here:
sudo gem install rails --version=3.0.1
The RVM documentation has this to say about that:
DO NOT use sudo...
to work with RVM gems. When you do
sudo you are running commands as root,
another user in another shell and
hence all of the setup that RVM has
done for you is ignored while the
command runs under sudo (such things
as GEM_HOME, etc...). So to reiterate,
as soon as you 'sudo' you are running
as the root system user which will
clear out your environment as well as
any files it creates are not able to
be modified by your user and will
result in strange things happening.
(You will start to think that someone
has a voodoo doll of your
application...)
I got a White Macbook and I have to go to a conference in 10 hours but I'm having a lot of problems.
First, I wanted to have Rails 3, so I used MacPorts to install Ruby 1.8.7. It worked well ;)
Then I was thinking I should install Rails 3, but no, no! It says:
$ sudo gem install rails --pre
ERROR: Error installing rails:
activesupport requires Ruby version >= 1.8.7.
What should I do? I already have 1.8.7!
First you need to install RVM, then the latest version of Ruby. Next you'll set that version of Ruby as the default. Finally, you'll install Rails b3.
Install RVM (http://rvm.beginrescueend.com/rvm/install/):
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
Install the latest Ruby (http://rvm.beginrescueend.com/rubies/installing/):
rvm install ruby-head
You can check which versions you now have installed with:
rvm list
Set the latest version of Ruby as default (replace 'ruby-1.9.2-head' with desired version):
rvm ruby-1.9.2-head --default
Make sure things are up to day, then install the Rails beta:
gem update --system
gem install rails --pre
You may have to install some gem dependencies before Rails will install.
To easily setup Rails 3 on osx machine the only thing you need to do is follow this brilliant (as always) Railscast, here for the transcription
You can also see comments to check for problems and eventually solutions.
You may have two different versions of Ruby installed. Try "gem env" or "sudo gem env" and see which version of Ruby it says you have.
Remove the older one if you have two installed. If all else fails, upgrade to 1.9.x, I believe it is recommended for Rails 3 anyway.
I would strongly recommend using RVM (Ruby Version Manager) to keep your Rails 3 separate from your Rails 2. (One example of Rails 2 conflicting with Rails 3: when you go to the command line to generate a Rails app, will it generate a Rails 2 app or a Rails 3 app? RVM allows you to keep them separate.)
Also, the latest Ruby 1.8.7 will probably not work with Rails 3, so you have to use an earlier patchlevel (248 works for me). Details are here: http://techiferous.com/2010/02/installing-rails-3-beta-with-rvm-and-ruby-1-8-7/
You should use rvm as others have said to manage multiple installations of Ruby and Ruby gems. (If you go that way, take the time to read rvm's documentation carefully.)
However, you should also get comfortable figuring out what version of Ruby your shell is seeing as the default and why. It sounds to me like your $PATH variable may not be properly updated. The $PATH variable is what determines which Ruby interpreter or gem command is the first seen, if you have more than one installed (as you now do). MacPorts will install new binaries into /opt/local/bin by default, and it should also alter your $PATH so that /opt/local/bin precedes /usr/bin (which is where Apple's out of the box Ruby lives).
I suspect that when you did sudo gem install, you were using /usr/bin/gem (which is the gem installer for /usr/bin/ruby rather than /opt/local/bin/gem (which would be the installer for MacPort's Ruby).
Check the output of echo $PATH, which ruby and which gem to see what's going on.
You should indeed use rvm, but as no one explained to you how to do this without rvm, here you go:
sudo gem install tzinfo builder memcache-client rack rack-test rack-mount \
abstract erubis activesupport mime-types mail text-hyphen text-format \
thor i18n rake bundler arel railties rails --prerelease --force
Based on your question and your responses to some of the answers, it sounds like you're not using the MacPorts version of Ruby. You should make sure that /opt/local/bin is in the front of your $PATH, before /usr/bin. Also, you should install RubyGems via MacPorts (sudo port install rb-rubygems) and make sure you're using the MacPorts gem. Then install Rails using the MacPorts gem.