gem installed in directory of different patchlevel - ruby

After updating from ruby-1.8.7-p352 to ruby-1.8.7-p358 via rvm, gems are still installed to the path of ruby-1.8.7-p352.
$GEM_PATH is set correctly but rvm gemdir is wrong.
# rvm use ruby-1.8.7-p358
Using /usr/local/rvm/gems/ruby-1.8.7-p358
# ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [x86_64-linux]
# echo $GEM_PATH
/usr/local/rvm/gems/ruby-1.8.7-p358:/usr/local/rvm/gems/ruby-1.8.7-p358#global
# rvm gemdir
/usr/local/rvm/gems/ruby-1.8.7-p352
Installing gems works without errors but the location of the gem is wrong and binaries can't be executed.
# gem instll bundler
Successfully installed bundler-1.1.3
1 gem installed
# bundle
bash: bundle: command not found
# which bundle
/usr/bin/which: no bundle in (/usr/local/rvm/gems/ruby-1.8.7-p358/bin:/usr/local/rvm/gems/ruby-1.8.7-p358#global/bin:/usr/local/rvm/rubies/ruby-1.8.7-p358/bin:/usr/local/rvm/bin:/usr/local/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
# gem which bundler
/usr/local/rvm/gems/ruby-1.8.7-p352/gems/bundler-1.1.3/lib/bundler
I tried export GEM_HOME=/usr/local/rvm/gems/ruby-1.8.7-p358 but rvm gemdir still shows the path to p358 and gems are installed to this path.

Updating the rubygems solved the problem:
# rvm rubygems latest

Related

Error ruby version When i'm running bundle install in Jekyll

I have reinstalled and updated my Ubuntu to 16.04, so now i have installed RVM for use Jekyll, but i have a problem when run bundle install of gemfile.
$ bundle install
Ignoring executable-hooks-1.3.2 because its extensions are not built.
Try: gem pristine executable-hooks --version 1.3.2
Ignoring gem-wrappers-1.2.7 because its extensions are not built. Try: gem pristine gem-wrappers --version 1.2.7
Your Ruby version is 2.3.1, but your Gemfile specified 2.2.0
$ ruby -v
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
$ rvm gemset list
gemsets for ruby-2.2.0 (found in /home/kedinn/.rvm/gems/ruby-2.2.0)
No running because this 2.3.1, but your Gemfile specified 2.2.0 why? if i have using ruby-2.2.0
It looks like you have both RVM and rbenv installed, and they are probably in conflict. Since they do more or less the same things, it should be safe to get rid of one of them. It means the rbenv installation of ruby is broken.
sudo rm -rf ~/.rbenv
Try installing Ruby like this

bundler, command not found

I wanna use the bundler, but after I installed rbenv, ruby and bundler, it still tells me command not found.
$ rbenv version
2.2.3 (set by /Users/khlee/.rbenv/version)
$ ruby -v
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]
$ export GEM_HOME=$HOME/Software/ruby
$ gem install bundler
Successfully installed bundler-1.12.5
Parsing documentation for bundler-1.12.5
1 gem installed
$ rbenv rehash
$ bundle install
-bash: bundle: command not found
Execute below command and check list of gem in gemset:
rbenv gemset list
May be budler gem is not installed in current gemset.

Installed Ruby 2.0.0, but an error tells me I have 1.9.3 installed

I just cloned my Rails app onto my new computer. Ruby 2.0.0 seemed to install with no issue, but when I run sudo bundle install inside my app, I get an error telling me I have Ruby 1.9.3 installed:
$ sudo bundle install
Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0
and bundle install returns this:
$ bundle install
/home/user/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- bundler (LoadError)
from /home/user/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/bin/bundle:7:in `<main>'
I don't understand why I would have 1.9.3 installed. I used the command rvm install 2.0.0 to install Ruby.
Also, ruby -v returns:
ruby 2.0.0p643 (2015-02-25 revision 49749) [x86_64-linux]
What's going on?
Output of rvm list
$ rvm list
rvm rubies
=* ruby-2.0.0-p643 [ x86_64 ]
# => - current
# =* - current && default
# * - default
Because you're using rvm, you shouldn't ever need to use sudo on any of your commands. Using sudo is likely running the globally installed 1.9.3 version.
If you just installed Ruby 2.0.0 and haven't done anything else, then you most likely need to install bundler first before using it:
gem install bundler
Once you've done that, bundle install (without sudo) should work fine.

A different rubygem version for each ruby version in rvm

I have ruby 1.8.7 and 1.9.3 installed by rvm. For each ruby version, I'd like to:
use gem 1.3.7 for ruby 1.8.7
use gem 1.8.x for ruby 1.9.3
How can I set the above in rvm?
$ rvm use 1.8.7
$ rvm rubygems 1.3.7
$ rvm use 1.9.3
$ rvm rubygems latest-1.8
$ gem -v
1.8.24
$ rvm use 1.8.7
$ gem -v
1.3.7
When install rvm and then rvm install ruby --version its taken latest rubygems version. So just follow the below steps:
rvm use 1.8.7
gem -v, e.g. shows 1.8.24 like that
If you want to use rubygems particular version only follow steps #3 and #4.
This is for syntax set the rubygems in rvm
rvm rubygems [x.y.z|latest-x.y|latest|remove]
Ex like this:
Retrieving rubygems-1.3.7
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 284k 100 284k 0 0 94166 0 0:00:03 0:00:03 --:--:-- 125k
Extracting rubygems-1.3.7 ...
Removing old Rubygems files...
Installing rubygems-1.3.7 for ruby-1.8.7-p371 ...
Installation of rubygems completed successfully.
then
gem -v => It shows 1.3.7
rvm rubygems 1.3.7
And If you want use any other version go to step #3
Ex: rvm rubygems latest
If you have already created gemsets in rvm for 1.3.7 and 1.8.x, skip this step. Otherwise, you need to create the gemset.
Here is how to create a gemset and then switch to it:
rvm 1.8.7 # switch to ruby 1.8.7
rvm gemset create 1.3.7 # you may have to do it this way: rvm --force rubygems 1.3.7
rvm gemset use 1.3.7 # use it
Next time you want to use ruby 1.8.7 with gemset 1.3.7 you only need to do this:
rvm use 1.8.7#1.3.7 # this sets the ruby version and gem version
ruby -v # checks the ruby version, should = 1.8.7
gem --version # checks the gemset version, should = 1.3.7
Repeat this for ruby 1.9.3 and gemset 1.8.x.
You can find out how to do this and find answers to questions other rvm related topics here: http://rvm.io/gemsets/using

rvm gemdir gives error ~/.rvm/scripts/gemsets: line 786: rvm command not found

I get an "rvm: command not found error" on rvm gemdir, but only when I'm using one of the rvm ruby installations. I get the same result with 1.9.2 and 1.8.7 (the only ones I've tried):
$ rvm install 1.8.7
...
Installation of rubygems completed successfully.
...
Install of ruby-1.8.7-p334 - #complete
# works ok using system ruby
$ rvm gemdir
/Library/Ruby/Gems/1.8
$ rvm use 1.8.7
Using /Users/aneil/.rvm/gems/ruby-1.8.7-p334
#
# HERE IS THE ERROR:
#
$ rvm gemdir
/Users/aneil/.rvm/scripts/gemsets: line 786: rvm: command not found
/Users/aneil/.rvm/gems/ruby-1.8.7-p334
$ rvm use system
Now using system ruby.
$ rvm gemdir
/Library/Ruby/Gems/1.8
Any ideas what's going on here? Should I be concerned?
Thanks.
try running
rvm get latest
from shell. addressed the issue for me.

Resources