I am not able to run bundle update devise or bundle install
$ bundle update devise
Fetching gem metadata from http://rubygems.org/.............
Fetching gem metadata from http://rubygems.org/..
Resolving dependencies............
Fetching rake 12.3.0 (was 10.1.0)
Installing rake 12.3.0 (was 10.1.0)
Gem::RuntimeRequirementNotMetError: rake requires Ruby version >= 2.0.0. The current ruby version is 1.9.1.
An error occurred while installing rake (12.3.0), and Bundler cannot continue.
Make sure that `gem install rake -v '12.3.0'` succeeds before bundling.
and this is what I am getting on $ bundle install
Fetching gem metadata from http://rubygems.org/.............
Fetching gem metadata from http://rubygems.org/..
You have requested:
devise = 2.2.4
The bundle currently has devise locked at 3.1.0.
Try running `bundle update devise`
If you are updating multiple gems in your Gemfile at once,
try passing them all to `bundle update`
Thanks in advance
From the log trace given it seems like you have specified the version 2.2.4 in gemfile for devise.
Just remove the version from gemfile and then run bundle update, rubygems will itself find the dependent gem version based on the ruby version and lock it the gemfile.lock.
The problem being that your Devise Gem is locked to a particular version which is the problem. If you check your gemfile.lock you will see its fixed.
Changing version in a Gemfile will not affect which gem version is loaded. bundle install / bundle update is actually needed.
Example of how you can go about that is in the Devise Gem documentation.
Change your gemfile to gem 'devise' and run bundle install rubygems will itself find the dependent gem version based on the ruby version and lock it to the gemfile.lock.
Related
I am getting this bundler error how do i resolve it.
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 4.2.11.3) was resolved to 4.2.11.3, which depends on
bundler (>= 1.3.0, < 2.0)
Current Bundler version:
bundler (2.3.12)
Your bundle requires a different version of Bundler than the one you're running.
Install the necessary version with `gem install bundler:2.0.0.pre.3` and rerun bundler using `bundle _2.0.0.pre.3_`
What do gem install bundler:2.0.0.pre.3 and bundle _2.0.0.pre.3_ command gonna do. Are they gonna replace my 2.3.12 and install 2.0.0
There can be multiple versions of the same gem installed in your gemset. Run this:
gem install bundler:2.0.0.pre.3
and then run this:
gem info bundler
you will find two versions of the gem installed. By default, it will run bundle with the latest version but as your gems are not compatible with it you can run bundle with a different version of the gem. To do that you need to run:
bundle _version_
in your case it will be:
bundle _2.0.0.pre.3_
You can also remove the other versions of the bundler gem and just keep the one that is compatible. To remove a specific version you could do:
gem uninstall bundler:2.3.12
I am trying to upgrade a gem (hydra-derivatives) to version 3.3.2 to see if it solves a bug we are having.
hydra-derivatives is not a Gemfile gem; it's bundled as a dependency of another gem, called hydra-works.
What I've Tried
bundle update --conservative
hydra-derivatives but that only upgraded hydra-derivatives to
3.2.2 (& we want 3.3.2) and its dependency mini_magick from 4.5.1 to 4.8.0
adding gem 'hydra-derivatives', '~> 3.3.2' but that gave me:
You have requested:
hydra-derivatives ~> 3.3.2
The bundle currently has hydra-derivatives locked at 3.2.1.
Try running `bundle update hydra-derivatives`
If you are updating multiple gems in your Gemfile at once,
try passing them all to `bundle update`
I don't want to run bundle update hydra-derivatives because I don't want it to update a bunch of unnecessary gems and cause problems, hence why I read about --conservative
a. I ran this anyway to test it, and it upgraded target gem to only 3.2.2 and 15 gems in total!
hydra-derivatives is not a Gemfile gem; it's bundled as a dependency of another gem, called hydra-works.
You can still add this as an explicit dependency in your Gemfile:
# only restrict the version if you know of an incompatibility
gem 'hydra-derivatives' , '~> 3.3'
then run
bundle update hydra-derivatives --conservative
or
bundle update hydra-works --conservative
Remove the hydra-works gem from your Gemfile.
Either remove the gem and its dependencies by hand from the installed gem location or if you have the application in its own Ruby environment using rbenv or rvm run bundle clean --force.
Beware bundle clean --force will remove all of the gems in the Ruby version other than those specified in your Gemfile. If you have other applications that use the same version of Ruby you'll have to reinstall the gems for that application if they are different than what you are using in this application.
Add this to your Gemfile
gem 'hydra-derivatives', '~> 3.3.2'
gem 'hydra-works'
And run bundle install
You should see the correct dependency version now in your Gemfile.lock
I am trying to rails server from a cloned repo, I have updated ruby, and rails, followed the rvm process, updated all my gem files, and when I go to serve I receive the message
Could not find globalid-0.3.7 in any of the sources Run bundle
install to install missing gems.
So I do bundle install, then get the error
An error occurred while installing pg (0.20.0), and Bundler cannot
continue. Make sure that gem install pg -v '0.20.0' succeeds before
bundling.
Try to insall that and then get
ERROR: Could not find a valid gem 'globalid-0.3.7' (>= 0) in any
repository ERROR: Possible alternatives: globalid, globalize3
I have googled everything and asked many.
globalid is a dependency of the Rails core gem ActiveJob so it is a required gem to have in your Gemfile.lock. See if it is listed in your Gemfile.lock file. If not you could add it to the top of your gemfile including the version
# gemfile
gem 'globalid', '0.3.7'
Then bundle install. If it works, then you can delete it from your gemfile since it should load automatically when Rails loads (since it is a dependency of Rails' ActiveJob). I've run into a similar issue with another gem and this process worked for me.
It could be a version error. Try using gem 'globalid', '~> 0.4.0' in your gemfile and bundling.
I am in an older Rails project that has a Gemfile. I tried to add a gem to the Gemfile and bundle install but got an error:
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 3.0.0) ruby depends on
bundler (~> 1.0.0) ruby
Current Bundler version:
bundler (1.1.5)
This Gemfile requires a different version of Bundler.
The version of Rails it's using requires bundler ~>1.0.0 but I have 1.1.5 installed and am using it for my other projects. Usually I would use bundle exec ... but since this is bundler we are talking about, it's a little more complicated than that. How can I add a gem to my Gemfile and run bundle install while using the version of bundler that it requires?
First you need to install the appropriate version of bundler:
% gem install bundler -v '~> 1.0.0'
Successfully installed bundler-1.0.22
Then force rubygems to use the version you want (see this post):
% bundle _1.0.22_ install
This is what I had to do to get it to work to install with a previous version (2.2.11) of bundler:
gem install bundler:2.2.11
bundle _2.2.11_ install
The error message In Gemfile: bundler (~> 1.16) is a bit inaccurate, since the version number requirement can come from other places, such as the .gemspec file, which was the case for me:
spec.add_development_dependency "bundler", "~> 1.16"
Removing the version number from the .gemspec file solved the issue for me:
spec.add_development_dependency "bundler"
I had the same issue on macOS Mojave. I installed the different version of the bundler gem and uninstall the current version.
gem install bundler -i '2.0.1'
gem uninstall bundler
Then gives me the option to choose the version to uninstall and I choose the one which is creating the problem.
If you use rvm to manage your ruby versions consider using gemsets for projects. This way you can install the specific version of bundler needed without having to specify the version each time.
You can confirm your gemset is loaded by running rvm info in your project directory.
Now you can install the version of bundler you'd like via gem install bundler -v '~> <VERSION>'. The next time you need to use bundler just run bundle.
I have a Rails 3.0.0 project that was using Ruby 1.9.2. Now that I tried to run it on a new computer with the current rvm, it will say:
$ rails s
/Users/michael/.rvm/gems/ruby-1.9.2-p318#global/gems/bundler-1.1.3/lib/bundler/resolver.rb:129:in `block in resolve': Bundler could not find compatible versions for gem "bundler": (Bundler::VersionConflict)
In Gemfile:
rails (= 3.0.0) ruby depends on
bundler (~> 1.0.0) ruby
Current Bundler version:
bundler (1.1.3)
but I already used
gem install rails -v 3.0.0
gem install bundler -v 1.0.0
gem install bundler -v 1.0.2
so that when I gem list, I will see
bundler (1.1.3, 1.0.22, 1.0.0)
rails (3.0.0)
so how come it is still complaining that Rails 3.0.0 requires bundler 1.0.0 and it is not there? How to make the project run again?
Update: my Gemfile is mostly comments except:
source 'http://rubygems.org'
gem 'rails', '3.0.0'
gem 'sqlite3-ruby', :require => 'sqlite3'
Update 2: if I run bundle check:
$ bundle check
Your Gemfile's dependencies could not be satisfied
Install missing gems with `bundle install`
$ bundle install
Fetching gem metadata from http://rubygems.org/.........
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 3.0.0) ruby depends on
bundler (~> 1.0.0) ruby
Current Bundler version:
bundler (1.1.3)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
The problem is that you have three version of bundler (1.1.3, 1.0.22, 1.0.0).And your app require only 1.0.0.And when you run server it use 1.1.3.
So first uninstall two bundler by this command
gem uninstall bundler -v=1.1.3
gem uninstall bundler -v=1.0.22
Then run server it will sure work....
You may need to run rails and rake inside the bundler context:
bundle exec rails s
Ditt with your rake commands, e.g.,
bundle exec rake -T
Here's a SO thread with links to more in depth articles. Also, lots of chatter about how to get around it if you get annoyed. Personally, I alias my most common commands anyway, so I don't even notice.
Just add Bundler into your gemfile to lock the version of bundler to use for that project.
gem 'bundler', '1.1.0'
If you do this you do not need to uninstall the other versions of Bundler, which you may be using on other projects with different dependencies.
You also shouldn't need to use bundle exec for any rails commands as Rails is bundler aware and will always run in the context of the current bundle. Non Rails commands require `bundle exec'.