Rails: GemNotFoundException
October 29, 2007 | 11:23 pmFor some reason, i could not find this information easily at one location, so i am dumping it here.
Running Ubuntu 7.10, i found myself re-installing ruby and rails on my system. Although prepackaged solutions containing both ruby and ruby on rails, i usually prefer to install ruby, and RubyGem, through my system’s package manager, and have gem freshly grab and install rails and all its dependencies.
So, here it goes:
sudo -s… (this sends you to an admin mode so that you do not have to type sudo over and over again … do not abuse it and exit as soon as you are done)apt-get install ruby rubygem… should take care of installing ruby and rubygem on your system. (Debian system assumed, On SuSE Yast does that as well).gem install rails --include-dependencies… oh oh …Gem::GemNotFoundException… no rails !!!gem env… should show you your “GEM PATH” (in my case /var/lib/gems/1.8). In that directory, there is a source_cache file.rm /var/lib/gems/1.8/source_cache…. Delete that file!gem update… update your gem cache filegem install rails --include-dependencies… yaay it worksexit… you must do this … do not abuse your root priviliges
This is it! The problem is that the stupid source_cache file is out of date and it needs to be resynchronized.
For some reason, after the successful installation i could not run the commands rails and rake directly from the console (without specifying the full path). This was because they were not added to /usr/bin. I didn’t bother googling for this because the solution is simple. If that happens with you, simply do the following:
cd /usr/bin… this directory contains links to all your executable … do not mess with it … baby pandas will die if you do.sudo ln -s /var/lib/gems/1.8/bin/rails… this creates a symbolic link to rails … notice that the bin directory is in gem path specified bygem env.sudo ln -s /var/lib/gems/1.8/bin/rake… do the same for rake … it is useful.
This is it … i hope somebody finds it useful.





















