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.
Related
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.
I am trying to use the prawn gem. I am just trying out the basic hello world example, on an ubuntu machine.
require 'prawn'
Prawn::Document.generate("hello.pdf") do
text "Hello World!"
end
First problem was that I was using ruby 1.9.1, it produced an error and said it needed ruby 2.0, so using RVM I updated to 2.2.1. However everytime I run this, I get this error
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require': cannot
load such file -- prawn (LoadError) from
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:inrequire' from
prawnpdf.rb:1:in `'
Now I am bit a newbie with Ubuntu and ruby for that matter, but I assume the issue is that it is looking in the wrong place for the prawn gem which I have installed ie it is looking in the old verison of ruby.
When I run $ ruby -v
I get
ruby 2.2.1p85 (2015-02-26 revision 49769) [i686-linux]
what am I doing wrong? any help would be most appreicated.
Follow the given step.
1: rvm list
rvm rubies
ruby-2.0.0-p643 [ x86_64 ]
ruby-2.2.1 [ x86_64 ]
=* ruby-2.2.4 [ x86_64 ]
2: rvm use < ruby-version > # for instances ruby-1.9.3-p125
rvm use 2.2.1
3: gem install prawn
Would work !!!
Each time you switch ruby versions with rvm, you start using a new gemset. Having previously installed prawn doesn't mean it is currently installed, and the error message suggests it's not installed. So:
rvm use 2.2.1
and then
gem install prawn
Then your code should work.
I suggest you create a Gemfile for your project so it becomes easier to maintain the dependencies.
See details: http://bundler.io/
Then cd into your project directory and install the bundle (once or after changes) and run your ruby script:
cd my_project
bundle install
ruby my_thing.rb
If you cannot/don't want to use bundler: you need to reinstall the Gem for every ruby.
This problem probably has an obvious answer to anyone who has used Ruby on linux for a long time, but I can't really get a good answer via Google.
I'm trying to check out the Rails 5 beta, which requires Ruby 2.2.2 or greater. I've installed the RVM (Ruby Version Manager) and set my ruby version to 2.2.3. Running rvm list in the terminal results in the following output:
rvm rubies
=* ruby-2.2.3 [ x86_64 ]
# => - current
# =* - current && default
# * - default
Okay, great. I have Ruby 2.2.3 installed. Let's try bundle update:
Installing rack 2.0.0.alpha (was 1.6.4)
Gem::InstallError: rack requires Ruby version >= 2.2.2.
Okay, that's weird. What version of ruby do I have? Running ruby -v gives me this:
ruby 2.1.5p273 (2014-11-13) [x86_64-linux-gnu]
So... do I have 2.2.3 or not? What gives?
Since you are using bundle, I would suggest you to check your Gemfile for ruby version. You can also test it with bundle exec ruby -v
Also try:
rvm use ruby-2.2.3
bundle exec ruby -v
Maybe by setting the default Ruby version on rvm to the one you have (ruby-2.2.3) solves the problem, by doing rvm --default use ruby-2.2.3. Then reload the bash and execute ruby -v to check if the default version of Ruby was changed properly and then try again to execute the bundle install command.
If you don't know zsh and oh-my-zsh, I highly recommend for this kind of things. You could configure the terminal in order to show you the current version of Ruby and Rails that you're using every moment. Check it here: http://ohmyz.sh/
In addition to doing rvm use --default 2.2.3 or rvm use 2.2.3 make sure that you don't have the ruby package from apt (or whatever package manager) still installed. For some reason, that ruby package could take precedence over an RVM Ruby.
Also, try doing rvm uninstall 2.1.5 to force your system to default to 2.2.3... You can always reinstall 2.1.5 later and, if this issue persists, 2.2.3 should stick as your default.
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
Strange... but this is what I got :
$ gem list | grep rvm
>> rvm (1.11.3.3)
$ gem uninstall rvm
>> INFO: gem "rvm" is not installed
How can that be possible? The root of this problem probably stems from me downloading the latest RVM and finding that it does not work with the latest version of POW. Thus I had to implode RVM and reinstall an older version. Since then when I do a cap deploy, I get the classic :
`<top (required)>': RVM - Capistrano integration was extracted to a separate gem, install: `gem install rvm-capistrano` and remove the `$LOAD_PATH.unshift` line, note also the 'set :rvm_type, :user' is now the default (instead of :system). (RuntimeError)
Any ideas?
I recently encountered the same rvm error:
"RVM - Capistrano integration was extracted to a separate gem, install: gem install rvm-capistrano and remove the $LOAD_PATH.unshift line, note also the 'set :rvm_type, :user' is now the default (instead of :system). (RuntimeError)"
Doing what the error suggested did not work for me at all.
What did work for me was to do: rvm -v
When I did this I saw that my rvm version was rvm 1.13.0
Using "rvm get" I did "rvm get 1.12.0" but still got the error
Then I tried "rvm get 1.11.0" and then presto, my rvm started working again.
I'm not 100% sure what caused the error in the first place but I think it all began when I tried to upgrade rvm with rvm get stable after I was unable to install some gems. I found out that I wasn't able to install gems anymore due to the fact that I had updated my xcode to 4.3.2 and apparently Apple changed their c complier which doesn't play nice with rvm.
Hope this helps someone.
Are you in a gemset? If so, that gem might be in the interpreter's unnamed gemset or the global gemset. If so, try
rvm use 1.9.3
gem uninstall rvm
or
rvm use 1.9.3#global
gem uninstall rvm
I just ran into this error as well. The error you ran into was because of the recent capistrano update. If you add rvm-capistrano to your gemfile and remove the $LOAD-PATH.unshift line from your capistrano deployment file it should work, at least it did for me.
That would be correct. Its in the 'global' gemset. This gemset is 'mixed in' to both the 'default' gemset and any gemsets you actually create.
Thus if you have Ruby 1.9.3 installed, for example, (rvm install 1.9.3) it will be installed into that ruby's 'global'. You can verify this by doing 'gem list rvm -dl' which will show you the name, version, description, and location on the disk of the requested gem.
∴ gem list rvm -dl
*** LOCAL GEMS ***
rvm (1.11.3.3)
Authors: Wayne E. Seguin, Michal Papis
Homepage: https://rvm.beginrescueend.com/
Installed at: /home/me/.rvm/gems/ruby-1.9.3-p194#global
RVM Ruby Gem Library
∴
I don't know why you want it removed, but you would do as Abe stated as the second choice.
To give more details, RVM works with POW, this is known issue: https://github.com/37signals/pow/issues/271
the easiest solution(in project dir):
rvm env . > .powenv
The version of RVM might not be compatible with POW. You can remove RVM and then install the most current version.
The problem is that RVM 1.12 and up does not play well with Capistrano.
So uninstall your RVM, then get RVM 1.11 (rvm get 1.11.0).
Nathan got it right: https://stackoverflow.com/a/10306090/294449
You used to have to do the unshift in your deploy.rb but the latest versions of RVM have made that hack no longer necessary. Just remove it and add the rvm-capistrano gem to your Gemfile. It works like a charm.