I'm upgrading my Rails application to 5.0 (5.0.0.1 current latest), I've also upgraded my Ruby version to 2.3.0p0 and bundler version to 1.13.6,
Now when I run bundle update it throws error like
devise (= 4.2.0) was resolved to 4.2.0, which depends on
railties (< 5.1, >= 4.1.0)
and so, I'd like to know if there is any automated way to auto update my gem version in gem file since I have around 100 gems in the GemFile
I would go with
$ bundle update
Because if gems you have specified in your Gemfile hasn't specified version, it will update your gems with latest available, and gems which has specified version with '~>' last patched version, for example from 1.0.1 to 1.0.2.
Also note, that bundle install will only install gems or missing gems specified in your gemfile, where bundle update will ugrade all gems managed with bundler.
Final, but that is just my opinion, I would wait with upgrading to Rails 5, just because not all gems are actually tested and upgraded to work with Rails 5.
You can do following things
Delete the GemLock file and do bundle install
OR
Do bundle update
If Still its not fixed
Remove the devise version that you have mentioned in GemFile and so bundle install so that it will automatically pick up the new version
Related
i m trying to run a rails application is my system but i m facing the issue is bundle version, i tried to install the required version but its not installling that one version and i m not able to remove the default version of bundler . i tried to go into installation_path:/specications/default/
and i remove the default version from this directory but still its showing the latest default version and current version
i m using rails 7.
but project is in lower than 7.
so what should i do?
In Gemfile:
rails (~> 3.2.21) was resolved to 3.2.22.5, which depends on
bundler (~> 1.0)
Current Bundler version:
bundler (2.3.24)
Your bundle requires a different version of Bundler than the one you're running.
Install the necessary version with `gem install bundler:1.17.3` and rerun
bundler using `bundle _1.17.3_ install````
Bundle install complains that it can't find compatible versions for gem "actionmailer," even though the dependency constraints it shows in the error do not conflict.
It gives me this output running bundle install which I'm so stumped by
In Gemfile:
premailer-rails was resolved to 1.10.3, which depends on
actionmailer (>= 3)
rails (> 3.0, < 3.2.22.1) was resolved to 3.2.22, which depends on
actionmailer (= 3.2.22)
The dependencies appear to not conflict at all.
I have tried explicitly setting rails to '3', instead of 3.2.22.1, which seems to remove the error. But isn't 3.x.x.x equal to >3 ?
In my Gemfile:
gem 'rails', '<3.2.22.1', '>3.0'
gem 'premailer-rails'
... #other gems
The output shows it resolves rails to 3.2.22, and that actionmailer >=3 is a dependency for premailer-rails, and actionmailer = 3.2.22 is a dependency for rails.
All constraints are met. 3.2.22 is >=3, and the dependency should resolve. What am I missing?
Did you install more recent Rails in this directory before? In this case bundler remembers its dependent actionmailer version and now this more recent actionmailer prevents installing the older one. Because install action in fact does conservative updating, analyzing only changes between last Gemfile.lock and current Gemfile.
Anyway, remove Gemfile.lock and run bundle install again.
I've just started working on a very old legacy app for a client, which is running on Ruby 1.9.3, Rails 3.2, and using JRuby on the production server. (Obstacles in upgrading the server has been a contributor to remaining on 1.9.3.)
Adding a gem to the Gemfile, even though the gem is compatible with 1.9.3, and even though I've added
ruby '1.9.3', :patchlevel => '551'
to the top of the Gemfile, Bundler continually chooses versions of other gems that require Ruby 2.0, and so updating fails. How can I get around this, without having to manually specify every single gem version that it fails on.
For example:
...
Using quiet_assets 1.1.0
Using rails 3.2.22
Using ref 2.0.0
Using rspec-rails 2.14.2
Fetching rspec_junit_formatter 0.3.0 (was 0.2.3)
Installing rspec_junit_formatter 0.3.0 (was 0.2.3)
Gem::InstallError: rspec_junit_formatter requires Ruby version >= 2.0.0.
An error occurred while installing rspec_junit_formatter (0.3.0), and Bundler cannot continue.
Make sure that `gem install rspec_junit_formatter -v '0.3.0'` succeeds before bundling.
I had to specify gem 'rspec_junit_formatter', '0.2.3', as well as all of the previous failures, in order to get this working. But that seems to defeat the purpose of Bundler. Why is Bundler ignoring Ruby versions when it builds its dependency graph, even though I've explicitly told it what version of Ruby to use?
Bundler is not ignoring the ruby version. When it installs gems it does not look at each gem and do a smart pick of which one to choose to get rid of any dependency issues (including the ruby version dependency).
In your gemfile, by not specifying the gem version, bundler will try to install the highest version it can. This is why it is good practice to specify exact versions for all your gems- so that if an update comes out for a gem in the repo you are getting the gem from- your project does not break.
Specifying the ruby version in the gem file is just like specifying the gem version for particular gem- it installs that version but does not affect the installation of any other gems.
I have a simple Gemfile for an iOS project using cocoapods:
# frozen_string_literal: true
source "https://rubygems.org"
gem 'cocoapods'
gem 'fastlane'
gem 'jazzy'
I've tried to update my bundle by a bundle update and jazzy went from version 0.8.2 to 0.0.14 so I rolled back my Gemfile.lock and did 3 invidual updates of my 3 gems and everything went fine, ie jazzy was still in version 0.8.2.
I redid a bundle update and, again, jazzy went from version 0.8.2 to 0.0.14.
What am I missing here? Why do I get a different set of versions with the same constraints?
A gist with more details about the content of the files: https://gist.github.com/dirtyhenry/135ec7ef73f873d5ac3236bc3da633ba
The issue is dependency hell.
Fastlane depends on xcpretty, which depends on rouge of major version 2 (~>2.0.7) and jazzy itself depends on different versions of rouge, major version 1 (~> 1.5) so, bundler tries to resolve highest version of jazzy to reuse existing rouge dependency (which is 0.0.14).
However, you can force bundler to use version 0.8.2 an more of jazzy, add to your Gemfile:
gem 'jazzy', '>=0.8.2'
instead of
gem 'jazzy'
And perform bundle update again.
See more details on versioning in bundler docs
I'm new to Rails, following Michael Hartl's textbook. When I run $ bundle install I get the following error:
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 3.0.1) ruby depends on
bundler (~> 1.0.0) ruby
Current Bundler version:
bundler (1.7.6)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
I then try $ gem install bundler which works fine:
Successfully installed bundler-1.7.6
Parsing documentation for bundler-1.7.6
1 gem installed
However, this doesn't solve the problem. I'm sensing this has something to do with version problems, but I'm not sure where to go with it...
The following :
In Gemfile:
rails (= 3.0.1) ruby depends on
bundler (~> 1.0.0) ruby
means the version of bundler required is greater than or equal to 1.0.0 but strictly less than 1.1.0. Rails 3 is depending on an old version of bundler. At this point of time, you should try out Rails 4 instead :)
You may read up more about the "version syntax" in http://guides.rubygems.org/patterns/#pessimistic_version_constraint
As #user3927334 has already stated the error you got is due to a version conflict between bundler and rails.
Most likely you have run rails new my_app with an outdated version of the rails gem.
gem install rails -v 4.2.0.beta4
Can be used to install a particular version of Rails. see Installing Rails.
You should then remove your old app and rerun the app generator:
rails _4.2.0.beta4_ new hello_app
If you indent to develop on your local machine I would recommend installing RVM (Ruby Version Manager) (as did previous versions of MH's Ruby on Rails Tutorial.)
It allows you to effortlessly switch between different versions of ruby and different sets of gems.