I was installing Rails 3.0.7 on my local machine yesterday and on a server today. I came across the same error both times:
This is the problematic part:
File not found: lib ERROR: While generating documentation for rails-3.0.7 ... MESSAGE: exit ... RDOC args: --ri --op /usr/local/rvm/gems/ruby-1.8.7-p334/doc/rails-3.0.7/ri lib --title rails-3.0.7 Documentation --quiet
Rails installed successfully but the Rdoc and ri documentation failed with this error. I ignored it in my local machine since I was in a hurry and Rdoc/ri were the least of my worries. But when it hapenned again in the server I just had to find out what the issue was. If you google it, many sources advise you to just uninstall that Rails version (in my case 3.0.7) and do this:
sudo gem install rails –no-ri –no-rdoc
I find that to be plain stupid! You are running away from the problem rather than solving it. The above command would just ignore the Rdoc/ri documentation.
The issue is that the new Rails version you are installing uses a more recent version of Rdoc/ri and thus when the installation process gets to Rdoc/ri installation, it fails. I don’t know why the ROR developers didn’t think of checking for this and updating Rdoc/ri for you. Anyway, the correct way to solve this issue is to first uninstall the Rails version you just installed with no Rdoc/ri data:
sudo gem uninstall rails –version 3.0.7
Install the latest version of the rdoc-data gem. This will install ri data for core and stdlib:
gem install rdoc-data
Then run:
rdoc-data –install
In case you want rdoc-data for all your gems run (not necessary.. takes a while if you have as many gems as i do):
gem rdoc –all –overwrite
To install ri data for RDoc 2.5+ run:
rdoc-data
Now you can install your Rails version and it will successfully install all the rdoc-data too.
sudo gem install rails
Output:
Successfully installed rails-3.0.7 1 gem installed Installing ri documentation for rails-3.0.7... Installing RDoc documentation for rails-3.0.7...
PROBLEM SOLVED! THANKS!!!!
Brilliant, just the problem I had encountered… AND solved just as you described. Thanks Joram
Thanks a lot! This actually saved my butt while struggling with installation today.
Me salvaste…
Thanks
Thanks for this! Solved my problem.
Brilliant! Thanks!
Thanks a lot, that solve the issue.
worked brilliantly. Many thanks!
you da man
Perfectly solved in Fedora 15. Thanks!
Just encountered the same problem, your suggestions fixed it for me.
Thanks!
Awesome. Thanks for documenting this.
Thank you! This is exactly what I was looking for. Have you considered submitting this bug to the official rails bug/issue tracker?
Man, i’ve had this error it seems like 10 times and this actually worked. Everywhere said to do sudo gem install rails –no-ri –no-rdoc. Solved!!!!
that’s really nice !
Thank you!
Problem Solved..rails installed successfully..thanks for the post
Super helpful…was really scratching my head on this one too!
going to give this a try when i get home, thanks for the info, i thought there was an issue with my new install of Kubuntu11.04 #smh
Nice to know this helped out so many people 🙂
Ah, its still not working for me! I am using the GM of Lion though..ill wait till the beta of xcode 4.1 downloads and try in the morning
Thanks, extremely helpful!
I install ruby with rvm, but recently installing rails 3.0.9 on the most recent rvm gives me a headace when trying to resolv the problem of missing ‘lib’ directory. rdoc-data –install will complain about the directory missing: /home/ikon/.rvm/gems/ruby-1.9.2-p290/gems/rdoc-data-2.5.3/data/1.9.2
I overcame with simply creating the missing end directory. Presto! Works 🙂 Hope it will help!
I am trying to install Rails 3.0 on OS X Lion and I am getting the errors described in this post.
But following the steps recommended I am getting an error on the “rdoc-data install” step. I get this error – “Could not find RubyGem rdoc-data”. If I run “gem list rdoc-data -d” it shows that the rdoc-data gem is installed and gives its location. Do you have any suggestions on how to get around this?
I am getting this issue installing rails 3.0.9 . I tried your approach but still gets the error. Any ideas?
Thanks!
that cmd is taking long time to execute…it it true??
i tried that way but still its sayin this-
Installing ri documentation for rails-3.1.0…
file ‘lib’ not found
Installing RDoc documentation for rails-3.1.0…
file ‘lib’ not found
can u help me out….
i tried that way but still its sayin like this-
Installing ri documentation for rails-3.1.0…
file ‘lib’ not found
Installing RDoc documentation for rails-3.1.0…
file ‘lib’ not found
can u help me out….
while uninstaliing rails this is wat i had got-
Removing rails
Successfully uninstalled rails-3.1.0
ERROR: While executing gem … (Gem::InstallError)
cannot uninstall, check `gem list -d ûversion`
I got same problem with Rails 3.1.0 but your solution didn’t work either. After running the steps in your post, on a last command ‘gem install rails’ it returned:
Fetching: rails-3.1.0.gem (100%)
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
what do you think?
Oh well, it actually did waste my time to an extent, I kept trying to make work, it didn’t! and it was pretty awful trying to guess at appropriate commands to use for a windows installation. The main problem I guess was my version of rails (the latest currently, v3.2.8). Anyway, to cut a long story short, this whole hassle isn’t necessary anymore. I found a neat installer package; RailsInstaller, it comes with everything you need: Ruby, rails, sqlite, rvm etc. it even comes with git installed.
Anyone who’s interested can find the package at http://railsinstaller.org/.