Posted at

bundle exec rails new が失敗する

More than 5 years have passed since last update.

ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin13.0]

rbenv 0.4.0
Rails 4.1.0
gem 2.2.2

gem list
sprockets (2.12.1, 2.11.0)
sprockets-rails (2.1.3)

bundle initしてGemfileのrailsのコメントを外してbundle exec rails newするとbundle installまで来て失敗します。


shell

Resolving dependencies...

Bundler could not find compatible versions for gem "sprockets":
In snapshot (Gemfile.lock):
sprockets (2.12.1)

In Gemfile:
sass-rails (~> 4.0.3) ruby depends on
sprockets (<= 2.11.0, ~> 2.8) ruby

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
run bundle exec spring binstub --all
/Users/yom/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/resolver.rb:228:in `resolve_for_conflict': Bundler could not find compatible versions for gem "sprockets": (Bundler::VersionConflict)
In snapshot (Gemfile.lock):
sprockets (2.12.1)

In Gemfile:
sass-rails (~> 4.0.3) ruby depends on
sprockets (<= 2.11.0, ~> 2.8) ruby

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.


Gemfile.lockにsprockets (2.12.1)を書き込んでるのは誰なんだろう?

深追いしてないけどとりあえずnewする際にbundle installをスキップしてlockを消してから手動でbundle installすれば通ります。


shell

$ bundle exec rails new . --skip-bundle

$ rm Gemfile.lock
$ bundle install


Gemfile.lock

    sass-rails (4.0.3)

railties (>= 4.0.0, < 5.0)
sass (~> 3.2.0)
sprockets (~> 2.8, <= 2.11.0)
sprockets-rails (~> 2.0)
sprockets (2.11.0)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)