How can I find out why a gem bundle has locked a gem at a specific version?
Turns out just running bundle update thrift
will show you what is locking the version:
$ bundle update thrift
Fetching source index for http://rubygems.org/
Bundler could not find compatible versions for gem "thrift":
In Gemfile:
evernote depends on
thrift (~> 0.5.0)
thrift (0.6.0)
How do I figure out which gem(s) caused a particular gem to be bundled?
Normally Gemfile.lock
documents which dependencies were generated from other dependencies, it's listed in a rough tree form, but you may have to do some digging to get to the right spot.
bundle wants to install an old version of a gem---how do I find out why?
Your Gemfile.lock
is what bundler actually checks when running bundle install
, at least after the first time you've run bundler for a given project (see this StackOverflow post). Check that file and see if anything looks amiss. You could also try deleting it and re-running bundle install
, or just run bundle update
to install the latest versions of all your gems if you're not concerned about specific versions.
Is there a way to get a gem's version before running bundle install (from Gemfile.lock)
By default if no version is specified in the Gemfile, running bundle install
will attempt to install the latest version of the gem which is compatible with the rest of the gems and ruby version in your project. This will create a Gemfile.lock file if one doesn't already exist. If a Gemfile.lock file is already committed to git repo, it should then install the versions specified in Gemfile.lock. The point of bundler is to handle dependencies to insure your stack works correctly.
To see the version of a gem bundler is currently using you can run
bundle show rails
You will probably want to specify the ruby version in the Gemfile for example
ruby '~> 2.5' #
You can specify exact version of a gem in the Gemfile like this which you should be able to rely on to be the version bundler will install so long as it's compatible with the rest of the stack. bundle install
will throw errors if there are incompatible gem versions.
gem 'rails', '4.2.11' # this will always install only this version.
You may also use pessimistic operator (~>)
to set for only minor updates
gem 'influxdb', '~> 0.6.1' # could go to 0.6.2 but never 0.7.0
You can also set minimum versions like this although it's probably not what you need for your question.
gem 'pg_query', '>= 0.9.0'
If you have a Gemfile.lock already in your repo you can see which version would be installed by running for example:
gem show rails
Which would show you the version and weather it or not it is currently installed.
For more info see bundle --help
Is it possible to verify if all gems in a Gemfile.lock exist at https://rubygems.org?
After suggesting a feature request with the developers of bundler
here: https://github.com/rubygems/rubygems/issues/4487, they suggested at least a viable work-around. Simply run this command:
bundle install --deployment --redownload
The --redownload
(or --force
) switch will force the download of every gem, even if the required versions are already available locally.
The --deployment
switch forces the usage of the exact versions specified in your Gemfile (and ignore patch upgrades like ~> 0.3.2
which would normally upgrade to e.g. 0.3.6
). The use of --deployment
is common practice during deployments.
This solution isn't ideal since it requires a full reinstall of all your bundle's gems. But it works!
Thanks to https://github.com/deivid-rodriguez for this suggestion.
Rails, Installed Gem version and Gemfile.lock version
Delete the Gemfile.lock
file. Then bundle install
again. Hopefully it will install again with jwt-1.5.3
. But make sure you have mentioned the version of jwt in gem file.
How do I find out which gem has a specific dependency?
In the bash shell you can do:
gem dependency name_of_the_gem --reverse-dependencies
For instance:
$ gem dependency activesupport --reverse-dependencies
Gem activesupport-2.3.14
Used by
actionpack-2.3.14 (activesupport (= 2.3.14))
activerecord-2.3.14 (activesupport (= 2.3.14))
activeresource-2.3.14 (activesupport (= 2.3.14))
Related Topics
How to Break Out of a Map/Collect and Return Whatever Has Been Collected Up to That Point
Cloning an Array with Its Content
Why Do I Need Asterisk Before an Array
Ruby on Rails - Generating Bit.Ly Style Identifiers
Remove Element at Specific Index from Redis List
Sass: Dealing with The Ie 4095 Selectors Per Stylesheet Restriction
Solid Tutorial for Building a Simple Wiki Application in Ruby on Rails
What Does It Mean Bundle_Disable_Shared_Gems: '1'
Sinatra + Heroku + Datamapper Deploy Issues with Dm-Sqlite-Adapter
Did I Install Ruby 1.9.3 Correctly on Rhel
How to Use Present? in Ruby Projects
When Trying to Generate a Model with Rails and Postgresql, the Command Hangs Without Error
Using Ruby 2.0 on Amazon Opsworks
Gem Install Rails Does Not Install Rails
Using Ruby 2.0 on Amazon Opsworks
Heroku Rails Rake Task to Sync Production & Local Db
Ruby Gem Installation Error After Osx Yosemite and Xcode 6 Installation