middleman / middleman-blog

Blog Engine Extension for Middleman
https://middlemanapp.com
MIT License
325 stars 179 forks source link

Error while trying to load the gem 'middleman-blog #287

Closed adarsh closed 8 years ago

adarsh commented 8 years ago

I'm getting the following error after

$ gem install middleman
$ middleman init
# ...

Then I add middleman-blog:

source 'https://rubygems.org'

gem 'middleman', '>= 4.0.0'
gem 'middleman-livereload'
gem 'middleman-blog'

And get this error:

$ middleman server
WARN: Unresolved specs during Gem::Specification.reset:
      activesupport (~> 4.2)
      padrino-helpers (~> 0.13.0)
      listen (~> 3.0)
      nokogiri (>= 1.3.3, ~> 1.3)
      mime-types-data (~> 3.2015)
      fastimage (~> 1.7)
      sass (>= 3.4)
      backports (~> 3.6)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
/Users/adarsh/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'middleman-blog'. (Bundler::GemRequireError)
    from /Users/adarsh/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from /Users/adarsh/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
    from /Users/adarsh/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
    from /Users/adarsh/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
    from /Users/adarsh/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
    from /Users/adarsh/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
    from /Users/adarsh/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/middleman-core-4.1.4/lib/middleman-core/load_paths.rb:35:in `setup_bundler'
    from /Users/adarsh/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/middleman-core-4.1.4/lib/middleman-core/load_paths.rb:15:in `setup_load_paths'
    from /Users/adarsh/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/middleman-cli-4.1.4/bin/middleman:10:in `<top (required)>'
    from /Users/adarsh/.rbenv/versions/2.3.0/bin/middleman:23:in `load'
    from /Users/adarsh/.rbenv/versions/2.3.0/bin/middleman:23:in `<main>'

This is under Ruby 2.3.0 using rbenv although I've tried other versions and system ruby (no rbenv) and got the same error.

tdreyno commented 8 years ago

bundle exec middleman server?

pilap82 commented 8 years ago

Hi, I get the same.

It looks like bundler is installing v0.1.5 of the gem!

My Gemfile.lock says: middleman-blog (0.1.5)

note sure how to override this though.

tdreyno commented 8 years ago

sounds like a ruby gems bug. You can force it in your Gemfile:

gem 'middleman-blog', '>= 4.0.0'
tdreyno commented 8 years ago

Reported to Bundler here: https://github.com/bundler/bundler/issues/4406

lamont-granquist commented 8 years ago

It looks like it is selecting fastimage-1.9.0 and then finding middleman-blog-0.1.5 (ancient) which allows installing that version of fastimage. Pinning both of them via:

gem "fastimage", "1.9.0"
gem "middleman-blog", ">= 4.0.0"

results in a dep conflict:

Bundler could not find compatible versions for gem "addressable":
  In Gemfile:
    fastimage (= 1.9.0) was resolved to 1.9.0, which depends on
      addressable (~> 2.3.5)

    middleman-blog (>= 4.0.0) was resolved to 4.0.0, which depends on
      addressable (~> 2.4.0)

    middleman-blog (>= 4.0.0) was resolved to 4.0.0, which depends on
      middleman-core (>= 4.0.0) was resolved to 4.1.6, which depends on
        addressable (~> 2.3)

fastimage and middleman-blog both should probably both be using semver pins like ~> 2.3 and ~> 2.4 if they can. if they can't, then they should try to agree on a minor version of addressable to use.

there most likely isn't a bug in bundler here since the Gemfile left bundler's depsolver free to downgrade middleman-blog as much as it liked, and it had to pick downgrading fastimage or middleman-blog -- in the absence of any human input it has to guess about which gem to downgrade and it simply guesses wrong, so you have to tell it what you really mean...

tdreyno commented 8 years ago

Can you try this now:

gem "middleman-blog", github: "middleman/middleman-blog"
joshukraine commented 8 years ago

FYI, I've just been getting started using middleman-blog and ran into this issue. I can confirm that once I locked addressable to 2.4.0 and pulled middleman-blog from Github, it worked fine.

lamont-granquist commented 8 years ago

@tdreyno that'll always work since you'll pull from GH and effectively pin the middleman-blog version...

lamont-granquist commented 8 years ago

@tdreyno i installed from git to my local gems and i get fastimage 1.9.0 and middleman-blog 4.0.0 now, so this looks fixed in master by your change. 👍

tdreyno commented 8 years ago

Should be resolved with blog v4.0.1

joshukraine commented 8 years ago

@tdreyno This looks good. However, when I initialize a new blog with Middleman (middleman init MY_BLOG_PROJECT --template=blog) it seems middleman-blog is requiring middleman 4.0.0 instead of the more current 4.1.x. Is there a reason for this?

tdreyno commented 8 years ago

No reason other than oversight :(

Fixed here: https://github.com/middleman/middleman-templates-blog/commit/e3128bcced09258badd1548eba19331f37faf364

Try now

joshukraine commented 8 years ago

@tdreyno Yep, works like a charm!