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...