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.
I currently have 2 ruby versions, 2.5.5 and 2.3.8, I am managing them with rbenv, and for gems, I use bundler to manage my specific gem versions. I have an issue when I want to switch to a project that uses 2.3.8 or a version that has to do with Ruby version 2.3.
My question is how do I get bundler to run the command to bundle install interact with my 2.3 projects.
My current version of bundler is 2.0.2.
I have already tried installing a lower version of bundler of which the bundler website claims to interact with ruby version 2.3.
I thought that if I specified the command to run bundle _version_ install it would work, but it still gave me the response that it needed ruby version 2.5 for bundler to work.
Lots of help appreciated.
In some situations, isolation can help. I would like to recommend rvm (https://github.com/rvm/rvm) for managing ruby versions. This tool is very similar to rbenv but in comparison, it allows you to create gemsets which are kind of containers of gems for special purposes. For instance:
rvm install 2.5.5 --disable-binary
rvm use 2.5.5#name-of-gemset --create
gem install bundler
bundle install # inside your project folder with Gemfile
I think that you will not have problems with versions again.
I am currently managing an installation of ruby 1.9.3 in red hat 5.
I have found that, during a specific gem install, ruby is trying to download and install the latest version of a particular required gem.
I have attempted to prevent the updating of gems using the --conservative flag, however, this does not seem to work.
The gem in question requires a specific version of launchy which, in turn, requires a specific version of addressable.
The versions of these gems that are already installed meet the requirements of the gem I am attempting to install. However, the gem command attempts to download and install the latest version of addressable.
This is a problem, because the latest addressable requires public_suffix, which only installs in ruby 2.x and greater.
The gem that I am trying to install is a custom gem, and thus I have modified the gemspec, and found that removing the launchy requirement fixes the issue. However, launchy is a required gem, so the requirement needs to stay in the dependency list.
Has anyone had any experience with dealing with this particular version of ruby and gem and found issues with dependencies?
I have tried going in and modifying gemspec for launchy and addressable in the installed gems dirs, but have found that the issue is with the gem install command attempting to update/install the latest gems despite giving it flags telling it otherwise.
ruby 1.9.3
gem 1.8.23
After some additional research prompted by the above responses, it was determined that an outdated version of Hoe was causing the generated gem to try and install the latest dependencies. After moving away from Hoe to manage dependencies and versions, my issue has been solved.
Some of the dependency management classes seem to behave quite differently, so that's probably the first place to look.
Use the -v flag to specify the exact version to install:
gem install your-custom-gem -v 1.1
I'm working on a project and we've just updated bundler to version 1.7.0. There was a few days of trouble in getting all the gemfiles/gemfile.locks in a correct state, but I'm still having trouble with one issue in particular.
If there are differences in Gemfile.lock, I check it out, and then bundle so that I will have the gems in the Gemfile. However bundle seems to always auto-upgrade my gems. For example:
Installing multi_json 1.10.1 (was 1.9.2)
The rest of my team is using 1.9.2 - there's a dependency in another part of the application or...who knows. I should be using 1.9.2, but bundler consistently 'auto-upgrades' everytime i run bundle. Is there a way to prevent this behavior? I'm using RVM 1.25.23
Bundler 1.7.0 has some bugs which can result in unexpected gem updates. Please try upgrading to the latest version (1.7.2 at the time that I write this).
See:
https://github.com/bundler/bundler/issues/3136
https://github.com/bundler/bundler/issues/3142
https://github.com/bundler/bundler/issues/3149
Try:
bundle install --frozen
This should prevent bundler to update the Gemfile.lock.
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...