Cannot specify bundler version when multiple are installed - bundler

Per Using multiple Bundler versions, https://github.com/rbenv/rbenv/issues/235, et. al. using underscores around the version number should allow me to use different bundler versions on my machine. However, this is not working for me.
When I specify a bundler version that I don't have installed bundler correctly complains though, so it seems to be version checking at least.
$ gem list bundler
*** LOCAL GEMS ***
bundler (2.0.2, 1.17.3, 1.17.0)
$ bundle _1.17.3_ -v
Bundler version 2.0.2
$ bundle _1.17.2_ -v
/Users/user/.rbenv/versions/2.3.6/lib/ruby/2.3.0/rubygems.rb:241:in `bin_path': can't find gem bundler (= 1.17.2) (Gem::GemNotFoundException)
from /Users/user/.rbenv/versions/2.3.6/bin/bundle:22:in `<main>'
I'm seeing this on OS X Mojave 10.14.6, but not running the same experiment on Ubuntu.
I'm looking for suggestions on debugging this.

Related

Bundler could not find compatible versions for gem "bundler", but gem list does not have the version that it says is installed

I'm using rbenv, ruby 2.6.5, and attempting to use bundler 2.0.2. Currently when I run gem list, bundler 2.0.2 is the only version shown on the screen. However, when I run bundle install in my project, an error is thrown stating that my current bundler version is 2.1.2. If I run bundler version in the shell, it indeed says 2.1.2. Where can I find this version and eliminate it?
Thanks,
Ed
Uninstall all versions of bundler with gem uninstall bundler and install the version you need again.

after bundler installed with specific version why version of bundler did not change?

I got following error for bundle
Bundler could not find compatible versions for gem "bundler": In
Gemfile:
bundler (~> 1.15)
Current Bundler version:
bundler (2.0.1) This Gemfile requires a different version of Bundler. Perhaps you need to update Bundler by running gem install
bundler?
Could not find gem 'bundler (~> 1.15)' in any of the relevant sources:
the local ruby installation
then I tried to downgrade the bundler version with
$ gem install bundler -v '~> 1.7.0' Fetching: bundler-1.7.15.gem
(100%) Successfully installed bundler-1.7.15 Parsing documentation for
bundler-1.7.15 Installing ri documentation for bundler-1.7.15 Done
installing documentation for bundler after 1 seconds 1 gem installed
but when I recheck the bundler version with
bundler --version
it still said Bundler version 2.0.1
The default bundler version on your system is still 2.0.1. If you need to use the downloaded version 1.7.15, you would have to run bundle _1.7.15_ install. You could also check if that version was successfully installed on your system using bundle _1.7.15_ -v
In either case, if you get the error Could not find command "_1.7.15_", then that means that the bundler version _1.7.15_ has not been installed on your system.
Additionally, these links may help you:
Run specific version of bundler
Downgrade Bundler in RVM
Try updating bundle with bundler update bundler and run the bundle update again. It solved my problem the last time.

Installing webistrano on ubuntu 13.10

I'm trying to install webistrano with latest ruby packages on ubuntu 13.10.
After inital configuration, each time when I'm trying to "bundle" things I'm getting following error:
confiq#home:~$ RAILS_ENV=production rake db:migraterake aborted!
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
bundler (~> 1.0.10) ruby
Current Bundler version:
bundler (1.4.0.pre.1)
Of course, I tried to install older bundler
confiq#home:~/$ gem list bundler
*** LOCAL GEMS ***
bundler (1.4.0.pre.1, 1.3.5, 1.0.10)
But dosen't matter which version of bundler I'm installing it always fails on same error message.
I'm in middle of dependency hell and this is just small portion of it...
The error is happening because the project specification requires bundler ~> 1.0.10. This means every version of bundler 1.0.x is allowed, but not bundler 1.3 or 1.4.
Even if you install an older version of bundler, by default the most recent one is used when you call bundle from the command line.
To force the use of an older version, you need to pass it in the following way
$ bundler _1.0.10_ ...
One additional node. Webistrano is a very old and unmaintained project. The last commit is older than 3 years ago.
I discourage you to use the project. It's likely you will encounter several other incompatibilities and the time you will waste trying to find a solution may not be worth.

bcrypt-ruby won't install with bundler but works fine with gem install

I just recently began having trouble with bundler - bcrypt-ruby will not install when doing a bundle install or sudo bundle install and exits with the following error:
Installing bcrypt-ruby (2.1.4) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
Gem files will remain installed in /home/deploy/vendor/bundle/ruby/1.8/gems/bcrypt-ruby-2.1.4 for inspection.
Results logged to /home/deploy/vendor/bundle/ruby/1.8/gems/bcrypt-ruby-2.1.4/ext/mri/gem_make.out
An error occured while installing bcrypt-ruby (2.1.4), and Bundler cannot continue.
Make sure that `gem install bcrypt-ruby -v '2.1.4'` succeeds before bundling.
However, gem install bcrypt-ruby -v '2.1.4' runs just fine (and in fact has already been run on this box). Running /usr/bin/ruby1.8 extconf.rb manually works just fine, and the resulting Makefile also runs with make just fine.
I'm using Ruby 1.8.7 and bundler 1.0.21 on Ubuntu 10.04.1 LTS. Other gems seem to be working fine through bundler. Though this is probably obvious, I've confirmed that the ruby-dev, gcc, etc packages are installed. I've tried using the --deployment option with bundler with no different behavior. The only thing I can think that has changed recently is I did a bundle update a couple days ago, so bundle got a minor version change (1.0.10 -> 1.0.21) and bcrypt appears to have gotten a major version change (2.1.4 -> 3.0.1).
Any help is appreciated!
Have you upgraded to Lion since you installed Ruby 1.9.2? If so it is probably linked to the wrong gcc.
Try uninstalling and reinstalling 1.9.2, I would suggest using rvm
rvm uninstall 1.9.2
rvm install 1.9.2
If that does not work you might have to implode rvm
rvm implode
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
source ~/.bash_profile
rvm install 1.9.2
try:
sudo apt-get install build-essential

sqlite3-ruby gem: Failed to build gem native extension

Update: Check out this follow-up question: Gem Update on Windows - is it broken?
On Windows, when I do this:
gem install sqlite3-ruby
I get the following error:
Building native extensions. This could take a while...
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.
c:/ruby/bin/ruby.exe extconf.rb install sqlite3-ruby --platform Win32
checking for fdatasync() in rt.lib... no
checking for sqlite3.h... no
nmake
'nmake' is not recognized as an internal or external command,
operable program or batch file.
Gem files will remain installed in c:/ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4 for inspection.
Results logged to c:/ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4/ext/sqlite3_api/gem_make.out
Same thing happens with the hpricot gem. I seem to remember these gems installed just fine on < 1.0 gems, but now I'm on 1.2.0, things have gone screwy.
I have also tried this:
gem install sqlite3-ruby --platform Win32
Needless to say, this doesn't work either (same error)
Does anyone know what is going on here and how to fix this?
Update: Check out this follow-up question: Gem Update on Windows - is it broken?
As Nathan suggests, this does appear to be related to the fact that the latest versions of the sqlite3-ruby and hpricot gems don't appear to have Windows versions. Here's what to do when faced with this situation (note, the name of the gem is automatically wildcarded, so you can type just sql and get a list of all gems beginning with sql):
$ gem list --remote --all sqlite
*** REMOTE GEMS ***
sqlite (2.0.1, 2.0.0, 1.3.1, 1.3.0, 1.2.9.1, 1.2.0, 1.1.3, 1.1.2, 1.1.1, 1.1)
sqlite-ruby (2.2.3, 2.2.2, 2.2.1, 2.2.0, 2.1.0, 2.0.3, 2.0.2)
sqlite3-ruby (1.2.4, 1.2.3, 1.2.2, 1.2.1, 1.2.0, 1.1.0, 1.0.1, 1.0.0, 0.9.0, 0.6.0, 0.5.0)
Then you can choose the version you would like to install:
gem install sqlite3-ruby -v 1.2.3
To successfully install hpricot, I did this:
gem install hpricot -v 0.6
Annoyingly, doing a gem update tries to update the gems to their latest, broken-on-Windows, versions. When the update routine encounters an error, it ditches you out of the whole process. There's a (hacky) solution to this problem here.
So, is this issue a bug in gems? Should gems not automatically detect the platform and install the latest compatible version?
I had the same problem on Ubuntu, this solved the problem for me:
http://newsgroups.derkeiler.com/Archive/Comp/comp.lang.ruby/2008-08/msg00339.html
first from sqlite.org(http://www.sqlite.org/download.html)
download ->
Precompiled Binaries: sqlite-dll-win32-x86-3071700.zip
and Source Code: sqlite-autoconf-3071700.tar.gz
then extract as:
-include
--sqlite3.h
--sqlite3ext.h
-lib
--shell.c
--sqlite3.c
--sqlite3.def
--sqlite3.dll
last install gem like:
gem install sqlite3 --platform=ruby -- --with-sqlite3-include=path\to\include
--with-sqlite3-lib=path\to\lib --no-ri --no-rdoc
Good luck!
Is it possible that the newest version has not yet been ported to Win32 yet? Since this particular gem does have bindings to compiled code, it would require a platform-specific gem. If I force installation of version 1.2.3 rather than the current 1.2.4, the platform-specific version does install, but when I allow gem to try to install the current version, I get the generic 1.2.4 version (in the gems library folder, it lacks the -x86-mswin32 suffix that the other sqlite3-ruby folders have in their names.
Maybe someone else can answer how gem handles platform specific gems. Are separate gems uploaded for each platform and the gem software selects which one to pull down?
I also ran into this problem. It's worth knowing that the difference between 1.2.3 and 1.2.4 is not significant. Here are the 1.2.4. release notes:
Release Name: 1.2.4
Notes: This release only updates the
generated C file to reflect the
compatibility changes that were made
to the SWIG file. Binary builds (e.g.,
Windows) are not affected, and need no
update. In general, you will not need
this update unless you are using a
version of Ruby prior to 1.8.6.
(source: 1.2.4. release notes)
Hope that helps others!
I had the same problem on Windows and I have installe MinGW
http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/MinGW%205.1.6/MinGW-5.1.6.exe/download
and the problem has gone :-)
C:>gem install hpricot
Successfully installed hpricot-0.8.2-x86-mswin32
1 gem installed
Installing ri documentation for hpricot-0.8.2-x86-mswin32...
Installing RDoc documentation for hpricot-0.8.2-x86-mswin32...
C:>gem install ruby-postgres
Successfully installed ruby-postgres-0.7.1.2006.04.06-x86-mswin32
1 gem installed
Installing ri documentation for ruby-postgres-0.7.1.2006.04.06-x86-mswin32...
Installing RDoc documentation for ruby-postgres-0.7.1.2006.04.06-x86-mswin32...

Resources