Ruby: gem installed in the wrong directory

I am new to Linux (using Ubuntu 10.10). I had a problem installing Rails 3.0.5 in the correct gem directory.

I have a Ruby root installation (1.8.7) that I accidentally installed (which probably had a gem version with it) and RVM that I specifically installed to control Ruby versions. I can by default use the Ruby version using RVM, no problem.

But when I try to set rails using the command:

gem install rails 

he sets the rails in the root stone directory: /var/lib/gems/1.8/gems

but instead I want to install the rails in the RVM directory: /.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems

Some of them, even after doing sudo apt-get purge ruby rubygems . The bad stone is still there. I define this by executing whereis gem (correct function?). Which returns /usr/bin/gem1.8 /usr/bin/gem /usr/share/man/man1/gem.1.gz

Now, how do I get rid of a bad gem and install the right gem in RVM?

By the way, my GEM_PATH /home/me/.rvm/gems/ ruby-1.9.2-p180@rails3 :/home/me/.rvm/gems/ ruby-1.9.2-p180@global : makes this more cryptic.

Any suggestion is appreciated,

Thanks :)

+4
source share
4 answers

There are several things that may be wrong:

  • Your default interpreter is not what you think:

Make sure you run: rvm --default use 1.9.2

After this run: ruby -v to make sure you really have the correct ruby ​​as the default ruby. If you do this, then gem install rails should work fine.

  • Your ruby ​​interpreter did not install correctly (or RVM itself did not install correctly - it is unlikely):

Your rvm may not have installed correctly, although this is unlikely. Most likely, your ruby ​​interpreter did not install correctly. I suggest uninstalling and then reinstalling, while it installs to carefully monitor any errors / warnings during compilation, and then with the installation of the interpreter, and then with the gems that RVM installs by default (rake, rubygems). You will probably see an error at one of these steps, which probably means that you are missing the library, which is necessary for the proper installation of ruby ​​or precious stones.

+3
source

if you want to install rails in the RVM directory, you just need to do this:

rvm gem install rails

+3
source

In the end, I deleted all the ruby ​​/ rvm / gems related things and started again. I used rvm (not sudo) to install everything and make sure that all ruby ​​stones fall into the .rvm directory in my user directory.

0
source

If rvm --default use 1.9.2 gives you this error:

 RVM is not a function, selecting rubies with 'rvm use ...' will not work. 

This means that you are not using a login shell, or you need to do /bin/bash --login . Found this solution at fooobar.com/questions/30301 / ...

0
source

Source: https://habr.com/ru/post/1341802/


All Articles