digital king
digital king

Reputation: 37

bundle update not working correctly

This is the error I'm getting with bundle update:

Bundler could not find compatible versions for gem "railties": In Gemfile: coffee-rails (~> 4.1.0) was resolved to 4.1.0, which depends on railties (< 5.0, >= 4.0.0)

rails (~> 5.2) was resolved to 5.2.0, which depends on
  railties (= 5.2.0)

sass-rails (~> 5.0) was resolved to 5.0.7, which depends on
  railties (< 6, >= 4.0.0)

web-console (~> 2.0) was resolved to 2.3.0, which depends on
  railties (>= 4.0)

I tried to check my rails -v and it told me to run bundle update and when I did, I got this error. Can anyone help ? I'm quite lost

Upvotes: 3

Views: 4547

Answers (1)

Jyrki
Jyrki

Reputation: 568

This error occurs because Bundler attempts to satisfy the version requirements of the dependencies, but is unable to do so as rails 5.2.0 requires the gem railties in the version 5.2.0, while coffee-rails 4.1.0 needs a version of railties which is less than 5.0 but greater than or equal 4.0.0. Those two requirements are conflicting with each other.

Luckily, solving that problem is really easy: all you need to do is to bump the version requirement of the coffee-rails gem to ~> 4.2. This can be done by changing the line gem "coffee-rails", "~> 4.1.0" (or similar) in your Gemfile to the following:

gem "coffee-rails", "~> 4.2"

After that change, bundle update should work just fine.

Upvotes: 2

Related Questions