I updated ruby gems with the following command:
gem update --system
Now I get the following error when running bundle install or just about any other gem command such as gem -v
/Users/darrenburgess/.rvm/rubies/ruby-2.0.0-p648/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:17:in `require': cannot load such file -- stringio (LoadError)
I can switch to the system ruby with rvm use system, and then gem commands seem to work, but I get the same error when I run rvm use 2.0.0 even though the output of rvm list shows =* ruby-2.0.0-p648 [ x86_64 ] as the current and default. Note that I can switch to other installed version of ruby such as 2.4.1 and 2.1.2.
When using system ruby the version of gem is 2.0.14.1
The version of RVM installed is 1.29.2 (current latest).
Output of which -a ruby
/Users/darrenburgess/.rvm/rubies/ruby-2.0.0-p648/bin/ruby
/usr/bin/ruby
/Users/darrenburgess/.rbenv/shims/ruby
Per other issues that are similar I checked to make sure that the RVM directory is first in my $PATH variable. This path is first in line:
/Users/darrenburgess/.rvm/gems/ruby-2.0.0-p648/bin
Unfortunately I am deeply into knows enough to be dangerous territory here. I believe what may be happening is that I have introduced incompatibility between my installed version of ruby/rubygems/rvm.
At this point I need help with different avenues to explore. Thank you.
UPDATE:
I have 3 versions of Ruby 2.0.0 installed as per rvm list
ruby-2.0.0-p481 [ x86_64 ]
=* ruby-2.0.0-p643 [ x86_64 ]
ruby-2.0.0-p648 [ x86_64 ]
I simply switched to using p643 and that fixed the issue, in so much as I am not using the trashed version of ruby == ruby-2.0.0-p648
So I guess at this point I have sidestepped the issue and the question now is simply what is wrong with ruby-2.0.0-p648 and how can it be fixed?
More information:
ruby-2.0.0-p643 is using gem version 2.4.6
ruby-2.0.0-p481 is using gem version 2.2.2
The current latest version of rubygems is 2.6.12
So I suspect that I upgraded rubygems to a version incompatible with ruby 2.0.0.
I did manage to fix the issue, but I am still uncertain as to why upgrading rubygems caused these issues.
Fix was to:
rvm remove ruby-2.0.0-p648
rvm install ruby-2.0.0-p648
gem install bundler
bundle install
So it seems removing the ruby version removes all of the installed gems and perhaps also the incompatible version of rubygems that I installed. Reinstalling ruby 2.0.0p648 resolved the issue.
Related
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 !!!
I'm getting the following bug when I run rails c:
Your Ruby version is 2.1.2, but your Gemfile specified 2.2.2
When I run $rvm list rubies, I get the following:
rvm rubies
=* ruby-2.2.2 [ x86_64 ]
I am confused. I tried to change the Ruby version in the Gemfile to 2.1.2 and install ruby-2.1.2. However I still get:
Your Ruby version is 2.2.2, but your Gemfile specified 2.1.2
Any suggestions?
Please install ruby-2.2.2 on your system then do either one of these:
1. rvm use ruby-2.2.2
2. create a .ruby-version file inside your application root folder with the following content:
2.2.2
Try this:
$ rm Gemfile.lock
$ bundle
Neither answer worked for me, and I already had 2.2.2 installed and specified in .ruby-version. What worked for me was
rvm use 2.1.2
rvm use 2.2.2
and then everything works fine. I suspect that rvm was somehow confused.
Declaration: In reality, I had this problem with swapping between 2.5.9 and 2.7.3.
Bundle fails to install better_errors.
Gem::InstallError: better_errors requires Ruby version >= 2.0.0.
An error occurred while installing better_errors (2.0.0), and Bundler cannot continue.
Make sure that `gem install better_errors -v '2.0.0'` succeeds before bundling.
But gem install better_errors works fine.
ruby --version says ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-linux-gnu]. I already tried upgrading to 2.1 but still not working.
Any suggestions?
I had this same problem. In my case, the bundler script had
#!/usr/bin/ruby
as the initial line in the script. As a result, it was calling the system (non-rbenv) version, which was 1.9.1 (in Linux Mint)
It's pretty hacky but changing that first line by running
sudo nano /usr/local/bin/bundle
to the full path for the rbenv shim (in my case):
#!/home/$YOUR_USERNAME/.rbenv/shims/ruby
solved the problem.
Hi for all the people who have different versions of ruby in their machine, and even if
rvm use ruby-version doesn't work.
Try this,
rvm list this will specify all the ruby version in your machine.
rvm rubies
* ruby-1.9.3-p484 [ x86_64 ]
ruby-2.1.0-preview2 [ x86_64 ]
ruby-2.1.1 [ x86_64 ]
=> ruby-2.1.5 [ x86_64 ]
In your project root folder, just create a file
.ruby-version
and add the ruby version you are planning to use.
ruby-2.1.5
Thats it, restart your application and try reinstalling your gems. :)
If you use rvm, make sure you don't have an .rvmrc file at the root of your project that force ruby < 2.0 to run, same with rbenv and .ruby-version file
It is said on the Rails 3.2.9 blog that Ruby 1.9.3-p327 is recommended to be installed. But
rvm install ruby-1.9.3-p327
actually gives an error, and the log says:
There is no checksum for
'http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p327.tar.bz2' or
'ruby-1.9.3-p327.tar.bz2', it's not possible to validate it. If you
wish to continue with unverified download add '--verify-downloads 1'
after the command.
But I checked http://ftp.ruby-lang.org/pub/ruby/1.9/ and the ruby-1.9.3-p286 has the same files as the p327. So where is the checksum located? Is it inside of the .bz2 file? So how should we install p327, is it just by
rvm install 1.9.3-p327 --verify-downloads 1
and is there security concerns, or are there other methods to install it safely?
First thing, make sure that your rvm version knows about this version by running rvm list known
On my machine, when I ran it the first time I got the following output for known MRI Rubies:
$ rvm list known
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7-p370
[ruby-]1.8.7[-p371]
[ruby-]1.9.1[-p431]
[ruby-]1.9.2-p180
[ruby-]1.9.2-p290
[ruby-]1.9.2-p318
[ruby-]1.9.2[-p320]
[ruby-]1.9.2-head
[ruby-]1.9.3-preview1
[ruby-]1.9.3-rc1
[ruby-]1.9.3-p0
[ruby-]1.9.3-p125
[ruby-]1.9.3-p194
[ruby-]1.9.3-[p286]
[ruby-]1.9.3-head
ruby-head
So my version of rvm only knew about 1.9.3-[p286] as the most recent version 1.9.3 version.
I got the latest version of rvm with the following command:
$ rvm get stable
After that, the list of known MRI rubies was as follows:
$ rvm list known
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7-p370
[ruby-]1.8.7[-p371]
[ruby-]1.9.1[-p431]
[ruby-]1.9.2-p180
[ruby-]1.9.2-p290
[ruby-]1.9.2-p318
[ruby-]1.9.2[-p320]
[ruby-]1.9.2-head
[ruby-]1.9.3-preview1
[ruby-]1.9.3-rc1
[ruby-]1.9.3-p0
[ruby-]1.9.3-p125
[ruby-]1.9.3-p194
[ruby-]1.9.3-p286
[ruby-]1.9.3-[p327]
[ruby-]1.9.3-head
[ruby-]2.0.0-preview1
ruby-head
A related thread on the rvm googlegroups discussion forum
In ubuntu 12.04, I use the cmd as follows, the newest version "-p327" will automatically detected and installed:
rvm install 1.9.3
The guide Installing Rails on Ubuntu 12.04 with RVM support may helps:
I'm running Ubuntu 10.04 and originally installed ruby 1.9.1 (from source). I've just decided to try out ruby 1.9.2 and rails 3, and it seemed like a good time to use rvm to deal with the multiple ruby installs and gemsets.
rvm installed and seems to be working, I installed ruby 1.9.2 in rvm and made that my default ruby. However, every time I try to install a gem under ruby 1.9.2 I see this error.
mark#Steve-Austins-Penguin:~$ gem install haml
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /home/mark/.gem/specs
gem environment returns:
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.9.2 (2010-08-18 patchlevel 0) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/mark/.rvm/gems/ruby-1.9.2-p0
- RUBY EXECUTABLE: /home/mark/.rvm/rubies/ruby-1.9.2-p0/bin/ruby
- EXECUTABLE DIRECTORY: /home/mark/.rvm/gems/ruby-1.9.2-p0/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/mark/.rvm/gems/ruby-1.9.2-p0
- /home/mark/.rvm/gems/ruby-1.9.2-p0#global
<snip>
But if the correct installation, ruby and gem paths are showing here why is ruby trying to install gems to /home/mark/.gem? All the variables and paths shown by env look right, and I can't find a .gemrc file anywhere on my system that might contain conflicting path settings.
So I guess my question is what might be causing rubygems to attempt to install to /home/mark/.gems instead of the correct paths set by rvm?
In response to the question below:
mark#Steve-Austins-Penguin:~$ echo $PATH
/home/mark/.rvm/gems/ruby-1.9.2-p0/bin:/home/mark/.rvm/gems/ruby-1.9.2-p0#global/bin:/home/mark/.rvm/rubies/ruby-1.9.2-p0/bin:/home/mark/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
mark#Steve-Austins-Penguin:~$ which gem
/home/mark/.rvm/rubies/ruby-1.9.2-p0/bin/gem
mark#Steve-Austins-Penguin:~$ rvm list
rvm rubies
ruby-1.8.7-p302 [ x86_64 ]
=> ruby-1.9.2-p0 [ x86_64 ]
mark#Steve-Austins-Penguin:~$ env
rvm_gemsets_path=/home/mark/.rvm/gemsets
MANPATH=:/home/mark/.rvm/man
rvm_scripts_path=/home/mark/.rvm/scripts
rvm_bin_path=/home/mark/.rvm/bin
GEM_HOME=/home/mark/.rvm/gems/ruby-1.9.2-p0
rvm_patchsets_path=/home/mark/.rvm/patchsets
SHELL=/bin/bash
IRBRC=/home/mark/.rvm/rubies/ruby-1.9.2-p0/.irbrc
rvm_patches_path=/home/mark/.rvm/patches
MY_RUBY_HOME=/home/mark/.rvm/rubies/ruby-1.9.2-p0
rvm_selfcontained=1
USER=mark
__shell_array_start=0
rvm_gems_cache_path=/home/mark/.rvm/gems/cache
rvm_config_path=/home/mark/.rvm/config
rvm_path=/home/mark/.rvm
USERNAME=mark
rvm_gemset_separator=#
rvm_ruby_args=
rvm_rubies_path=/home/mark/.rvm/rubies
PWD=/home/mark
rvm_hooks_path=/home/mark/.rvm/hooks
rvm_version=1.0.1
rvm_src_path=/home/mark/.rvm/src
HOME=/home/mark
rvm_gems_path=/home/mark/.rvm/gems
rvm_ruby_string=ruby-1.9.2-p0
BUNDLE_PATH=/home/mark/.rvm/gems/ruby-1.9.2-p0
rvm_tmp_path=/home/mark/.rvm/tmp
LOGNAME=mark
GEM_PATH=/home/mark/.rvm/gems/ruby-1.9.2-p0:/home/mark/.rvm/gems/ruby-1.9.2-p0#global
rvm_action=list
rvm_log_path=/home/mark/.rvm/log
rvm_interactive=1
RUBY_VERSION=ruby-1.9.2-p0
rvm_archives_path=/home/mark/.rvm/archives
rvm_repo_path=/home/mark/.rvm/repos
_=/usr/bin/env
Note that I've edited down the response from env slightly - simply to keep the size of this post under control - by removing all the entries relating to X, GNOME and SSH.
Following up the backtrace from running gem install -V --backtrace --debug haml (thanks zzzhc) and taking a closer look at the /home/mark/.gem directory I found that there were no gems installed there, just gemspec files and gem source files. In the spirit of experimentation I deleted /home/mark/.gem and re ran the gem install command and suddenly it was working. And that it had recreated /home/mark/.gem containing gemspecs for the gems I'd just installed.
It's clear now that I'd misinterpreted the error message in the original question; rubygems didn't fail while trying to install gems to /home/mark/.gem, it was simply using that directory as a temporary store for the gemspecs of newly downloaded gems about to be installed. Before installing rvm I'd been installing gems onto the system using sudo gem install... which would have created the /home/mark/.gem directory with root permissions. So rubygems run without sudo was unable to access the temp directory to store gemspecs in and was aborting before it could install the gems. Doh!
Another way is type which gem after getting into the ruby version. You will get something like this - /home/username/.rvm/rubies/ruby-1.9.2-p180/bin/gem. Now just type sudo /home/username/.rvm/rubies/ruby-1.9.2-p180/bin/gem install gem_name.
Specifying the complete path and adding sudo work fine.
check the first line of /home/mark/.rvm/rubies/ruby-1.9.2-p0/bin/gem and look at http://yehudakatz.com/2010/08/24/a-tale-of-abort-traps-or-always-question-your-assumptions/