RVM ruby version 2.2.1, Actual ruby version 1.8.7 - ruby

I am trying to install Jekyll in a VM for my web course and it required ruby >= 2.0.0.
I've gone through installing RVM and using this to install the desired version of ruby, but I then get the following:
vagrant#precise32:~/.rvm/bin$ bash rvm list
rvm rubies
ruby-2.1.1 [ i686 ]
=* ruby-2.2.1 [ i686 ]
 # => - current
 # =* - current && default
 # * - default
vagrant#precise32:~/.rvm/bin$ ruby -v
ruby 1.8.7 (2011-06-30
patchlevel 352) [i686-linux]
vagrant#precise32:~/.rvm/bin$ sudo gem
install jekyll ERROR: Error installing jekyll:jekyll requires Ruby version >= 2.0.0.
vagrant#precise32:~/.rvm/bin
I don't understand why it still thinks it is using version 1.8.7, as it confirms that it has installed 2.2.1.
I have done the following:
Use sudo chown to change ownership of the .gnupg folder recursively to vagrant (my system user) as defined here.
Install RVM following the instructions here.
Installed the version (2.2.1) of ruby using these instructions (https://rvm.io/rubies/installing).
Tried to install Jekyll using sudo gem install jekyll, but I get an error saying that I need ruby version 2.0 or higher.
I'm not a developer, this is an introductory web development course. Also please excuse the corrupt link, I can't post more than 2.
Update: I think I might need to do something as described here: How do I change my Ruby version using RVM?.
Also - although I installed RVM, I originally installed it using sudo apt-get which corrupted it. I uninstalled that, and ran the most recent install with curl. To use it I have to navigate to the directory and use "bash rvm list"

Add following two lines:
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
to your $HOME/.profile file and restart a shell.

It seems your machine is using Its own instead by RVM.
1: rvm list # Listing install rubies will you get versions of ruby which is installed by RVM
2: rvm use < ruby-version > # for instances ruby-1.9.3-p125
3: bundle install
4: Tried to install Jekyll using sudo gem install jekyll, but I get an
error saying that I need ruby version 2.0 or higher.
For that you could try Installing Jekyll on Ubuntu 14.04
Hope this help you !!!

Related

Cannot install jekyll as it complaints: 'requires Ruby version >= 2.3.0'

I have only one ruby version installed:
$ rvm list
=* ruby-2.5.7 [ x86_64 ]
# => - current
# =* - current && default
# * - default
But any time I install jekyll or bundler I got complain of an older version.
$ sudo gem install bundler
ERROR: Error installing bundler:
bundler requires Ruby version >= 2.3.0.
Unable to find the reason.
Operating system: CentOS
When using RVM as your Ruby manager you do not (and should not) use sudo. Sudo runs everything under the root account. But RVM is installed under your own user account, and therefore sudo is not needed, and will in fact circumvent RVM if used.
So, just drop the sudo part, and if RVM is installed properly, everything should start working correctly:
gem install bundler # <- no sudo needed
I bit late, but I had the same problem and couldn't find an answer documented anywhere.
The problem is that sudo uses a different version of ruby than what rvm has set. You can see this by comparing ruby -v and sudo ruby -v.
To solve this, try rvmsudo gem install bundler. This causes sudo to use the version of ruby that rvm expects.
Read more here: https://rvm.io/integration/sudo

RVM and Ruby version not working as expected

I want to install the compass html5 boilerplate gem. When I try to install it I get the following error.
$ sudo gem install html5-boilerplate
ERROR: Error installing html5-boilerplate:
compass-h5bp requires Ruby version ~> 2.0.
Then when I check my ruby version it says:
$ ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
But I used RVM before so I thought I could just change version but when I check it says I'm using ruby-2.2.0 already.
$ rvm list
rvm rubies
=* ruby-2.2.0 [ x86_64 ]
# => - current
# =* - current && default
# * - default
I think I must be missing something obhvious, it's been a while since I've worked with Ruby and RVM.
Update 1
I ran the below commands as suggested by #tadman and it does seem the wrong path is being used.
~:$ cd ~/.rvm/bin
bin:$ ls
ruby-rvm-env rvm rvm-auto-ruby rvm-exec rvm-prompt rvm-shebang-ruby rvm-shell rvm-smile rvmsudo
bin:$ which ruby
/usr/bin/ruby
UPDATE 2
After correcting the path in my .bash_profile the ruby version seems correct but I'm still getting the same error when trying to install the html5-boilerplate gem??
$ sudo gem install html5-boilerplate
ERROR: Error installing html5-boilerplate:
compass-h5bp requires Ruby version ~> 2.0.
$ ruby -v
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
$ rvm list
rvm rubies
=* ruby-2.2.0 [ x86_64 ]
# => - current
# =* - current && default
# * - default
$ compass -v
Compass 1.0.3 (Polaris)
Copyright (c) 2008-2015 Chris Eppstein
Released under the MIT License.
Compass is charityware.
Please make a tax deductable donation for a worthy cause: http://umdf.org/compass
Also i have the compass gem installed on both Ruby 1.9.1 and RVM's ruby 2.2.0. Could this have something to do with it?
$ pwd
/var/lib/gems/1.9.1/gems/compass-1.0.3
$ cd /home/ross/.rvm/gems/ruby-2.2.0/gems/compass-1.0.3
$ pwd
/home/ross/.rvm/gems/ruby-2.2.0/gems/compass-1.0.3
Is there a way to check which ruby version compass is using?
Having RVM and having RVM installed correctly are two different things. The most common cause of a mismatch like this is that your system Ruby has priority in your PATH.
In a POSIX shell, which ruby will tell you which one is getting executed. It is probably the wrong one.
RVM does its magic by manipulating which Ruby shows up in the RVM bin path, often ~/.rvm/bin or something similar. To get it to work correctly you'll need to ensure that path is first in your $PATH.
You may want to try reinstalling the RVM stub, or check that it's correctly loaded into your environment.

Why does Ruby or RVM seem stuck at 1.8.7 on Linux Mint?

I am on Linux Mint 12.
I installed RVM and ran these commands:
rvm 1.9.2
rvm --default use 1.9.2
but ruby -v still outputs ruby 1.8.7.
sudo apt-get install ruby1.9.2 returns saying 1.9.1 is the latest version.
How do I get Ruby to be running on 1.9.2?
When I run rvm list like suggested at "Ruby 1.9.2 keeps reverting back to 1.8.7 after installing it using RVM", it outputs:
rvm rubies
ruby-1.8.7-p352 [ x86_64 ]
=> ruby-1.9.2-p290 [ x86_64 ]
So I think I must have a configuration issue. My OS seems to be defaulting to the wrong version of Ruby.
I ran:
sudo apt-get remove ruby
But had no change.
You add string [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" into ~/.bashrc? First, show your echo $PATH output. If this looks like (rvm paths before system paths):
/home/ayunin/.rvm/gems/ruby-1.9.3-rc1/bin:/usr/bin:/bin:/usr/bin/X11
Then you ran into the magick. Restart your terminal, and show ruby version. If does not work - you can launch rvm implode and reinstall all, yes.
It looks like Linux Mint 12 has ruby-rvm already installed (at least on my machine) so could this be a problem?
you can stick with that but then I think you will need to add your username to the rvm group with usermod -a -G username rvm.
I removed removed ruby-rvm completely (with apt-get) and then followed the installation instructions from https://rvm.beginrescueend.com/rvm/install/ for 'single user' thus all my rvm files are located in ~/.rvm/bin/rvm
I added the line for rvm in my .bashrc and tested with 1type rvm | head -1`.
After that rvm install 1.9.2 just worked and I installed it into ~/.rvm/rubies/ruby-1.9.2
After that rvm use --default 1.9.2 set all up correctly.

RVM on Ubuntu Troubles

I've run into a lot of issues whilst attempting to install RVM on Ubuntu 9.10. Here's the steps I've tried doing:
install ruby (via ruby site, no package manager)
download rvm
install rvm (make edit to .bashrc)
use rvm to install ruby version & gems
Is there any crucial step that I seem to be missing?
Be sure to have selected an installed ruby (the --default portion tells rvm you want this ruby to be your default ruby version). Something like:
rvm --default use 1.9.2
Also this command will tell you which ruby is currently selected:
rvm list
And hopefully you'll see something like:
rvm rubies
ruby-1.9.2-p0 [ x86_64 ]
=> ruby-1.8.7-p302 [ x86_64 ]
At this point, you'll be able to install gems and hopefully have a successful rvm install and working environment.
I've had issues in the past where I didn't have an rvm ruby selected and was still working with my distribution's ruby and gems and got mixed up easily. Make sure you're ruby and gem commands are working out of your ~/.rvm folder whith the following commands:
which ruby
which gem
Good luck!
What are the issues you're running into? Sometimes I forget to switch into the correct rvm environment (e.g. rvm ree), so it helps to place a .rvmrc file in project directories.
I would start off by removing ubuntu's ruby installation so that you don't have to worry about conflicts (although rvm will setup your PATH correctly). Following the instructions at RVM, run the following command to install rvm,
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
and then install system dependencies as listed in rvm notes. and then install the specific ruby version you want (e.g. rvm install ree or rvm install 1.9.1)
Important : for a good installation try this :
type rvm | head -n1
Must return : rvm is a function
else add this line
[[ -s "/usr/local/rvm/scripts/rvm" ]] && . "/usr/local/rvm/scripts/rvm"
in your profile.

Install Rails 3 on OSX with RVM

Trying to install the new Rails 3 release on OSX 10.6.
Have never touched Ruby or Rails on this machine since purchased.
I was able to get rvm and get Ruby 1.9.2. installed. From there, I am stuck.
I tried:
rvmsudo gem install rails -v 3.0.0
sudo gem install rails --pre
sudo gem install rails
sudo gem update rails
And I get the same result error each time:
ERROR: While executing gem ... (Errno::ENOENT)
No such file or directory - /Users/kevin/.rvm/gems/ruby-1.9.2-head#rails3/cache/activesupport-3.0.0.gem
If I do gem list, it says LOCAL GEMS and doesn't list anything.
I have read a few walkthroughs but honestly none of them address this issue and its kind of pissing me off. Why is this so difficult to install? Would love to learn it if someone could help me get it running.
I was trying to follow this:
http://eddorre.com/posts/installing-rails-3-beta-4-using-rvm
and this:
http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard
Which is actually linked from the ROR guides website. Am I missing dependencies? How do I get them in?
If I do rails -v I get:
rails -v
/Library/Ruby/Site/1.8/rubygems.rb:779:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
from /Library/Ruby/Site/1.8/rubygems.rb:214:in `activate'
from /Library/Ruby/Site/1.8/rubygems.rb:1082:in `gem'
from /usr/bin/rails:18
Older versions of rvm had a bug that can cause your ruby versions to get crosswired because the OS can cache executable paths for the which command (particularly if you are using zsh). See this long, detailed, mind blowing post by Yehuda Katz on the subject.
What I had to do this morning:
rvm update && rvm reload # update rvm
rvm gemset delete rails3 # delete old gemset
rvm install 1.9.2
rvm use 1.9.2
rvm gemset create rails3
rvm use 1.9.2#rails3
which ruby # check to be sure the ruby interpretter is properly set to 1.9.2
hash -r # if ruby interpretter is not pointing to 1.9.2
gem install rails
which rails # check to be sure we are using rvm version of rails
Note: On newer versions of rvm, you will have to use rvm get stable instead of rvm update
You don't need to use sudo when installing gems with rvm. If you follow the directions here to get RVM installed, you should be able to just do rvm use 1.9.2; gem install rails --version 3.0.0.
You don't have to specify version 3. If you have 1.9.2-p0, it will automatically get rails 3 when you rvm gem install rails 3. note: no sudo. I think when you use sudo it makes it use the system-installed ruby. If you think you need sudo, use rvmsudo.
Things probably got messy because you were following guides based on the pre-stable release of rails, which involved many other things. If you like, you can try uninstalling rvm and re-doing everything. It really isn't all that difficult.
Remember, you need 1.9.2, 1.9.1 won't work.
curl -O http://rvm.beginrescueend.com/releases/rvm-install-head
sh rvm-install-head
rvm install 1.9.2-p0
# also remember to edit your bash profile and add the required lines
# verify that 1.9.2-p0 shows up there
rvm list
# makes it so you're using it, and sets it as the default
rvm use 1.9.2-p0 --default
# verify this happened. should have => 1.9.2-p0 in the list
rvm list
# verify the version
ruby --version
# should automatically get 3.0
# `rvm gem install` installs it for every single installed ruby version
# in my experience
gem install rails
When you did rvm gem install, I think it installs it for every ruby version you have registered with rvm (at least it happened in my experience), so my assumption is that it was trying to force install rails 3 for an older ruby installation, which was missing the required gems.
Take it easy, not many commands are required. If you find yourself having to do 'hacks' or workarounds, then you're doing it wrong. Thankfully it's easy to start over. To remove rvm, just do rm -rfv ~/.rvm and also rm ~/.rvmrc if it's there.
Let me know how it goes.
working through this myself as new user mac osx blah blah
seems like a cache directory doesn't get made, try
mkdir $HOME/.rvm/gems/cache
so far so good after that...
I am running into the same problem (tried uninstalling and installing like Blaenk suggested)
rvm -v
rvm 1.0.2 by Wayne E. Seguin (wayneeseguin#gmail.com) [http://rvm.beginrescueend.com/]
ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]
gem install rails
ERROR: While executing gem ... (Errno::ENOENT)
No such file or directory - /Users/pragnesh/.rvm/gems/ruby-1.9.2-p0/cache/activesupport-3.0.0.gem
After doing "rvm update && rvm reload" rvm got updated to 1.04 (instead of 1.02 which I got via the recommended GIT install yesterday!?) it worked nicely.
The solution worked for me, with a few tweeks:
Instead of using rvm update, I had to use rvm rubygems. Then, after doing all the work from post 2, I had to execute bundle install and I entered rvm use 1.9.2#rails3 to my .rvmrc file. Everything now works like a charm, even when starting a new shell or terminal session. The full list of commands I used is:
>> NEW >> rvm rubygems
rvm reload # update rvm
rvm gemset delete rails3 # delete old gemset
rvm install 1.9.2
rvm use 1.9.2
rvm gemset create rails3
rvm use 1.9.2#rails3
which ruby # check to be sure the ruby interpretter is properly set to 1.9.2
>> DID NOT NEED >> hash -r # if ruby interpretter is not pointing to 1.9.2
gem install rails
which rails # check to be sure we are using rvm version of rails
>> NEW >> bundle install
>> NEW >> cat 'rvm use 1.9.2#rails3' > .rvmrc
Followed these instructions, and found them very useful for rvm installation. Hope they work for you.
http://adventuresincoding.com/2010/01/taking-the-helm-of-ruby-with-ruby-version-manager/
Doing this after the rvm update and reload worked for me:
rm -rf .bundle && bundle install

Resources