Updating from Rails 4.0 to 4.1 gives sass-rails ra

2020-03-03 09:55发布

问题:

I'm trying to update my Rails 4.0 app to 4.1. The app uses sass-rails, and when I try to update it using bundle update rails I get the following error:

Bundler could not find compatible versions for gem "railties":
  In Gemfile:
    rails (= 4.1) ruby depends on
      railties (= 4.1.0) ruby

    sass-rails (~> 4.0) ruby depends on
      railties (4.1.1)

Any idea how to work around it or fix it?

回答1:

From comments, update to:

gem 'rails', '~> 4.1.1'


回答2:

The latest version of sass rails solves this issue:

gem 'sass-rails', '~> 5.0.0.beta1'


回答3:

Updating bundler solved this for me:

gem install bundler

Apparently there was a bug in older bundlers.

Taken from related question: sass-rails requires sprockets 2.0.0 but rails 4.1.0 requires sprockets 2.12.1



回答4:

I just spent 1h trying to add susy 2 to my project... Thamn are those dependencies a bi*ch... To set up rails 4, sass-rails, compass-rails and susy I changed my Gemfile into:

gem 'rails', '~> 4.1.1'
gem 'sass-rails', '~> 5.0.0.beta1'
gem 'compass-rails'
gem 'susy' 

What I didn't want to do, but ended up doing is updating rails from 4.0.3 to 4.1.1 and what bothers me even more is using sass-rails 5.0.0.beta1