Bundler 1.11.0 Error - [solved by 1.11.2 version fix release]

It seems Bundler 1.11.0 is having issues when you use a specific version of Ruby (we use Ruby 2.1.7). There is an open issue on github here but we’d like to still know how to use a prior version of bundler in the future.

It fails with the error:

./ci-build.rb install
Installing project: admin
--- ERROR REPORT TEMPLATE -------------------------------------------------------
- What did you do?

  I ran the command `/home/ubuntu/.rvm/gems/ruby-2.1.7@global/bin/bundle install --without=development --path=/home/ubuntu/applicationnamehere/vendor/bundle --jobs=4 --retry=3`

- What did you expect to happen?

  I expected Bundler to...

- What happened instead?

  Instead, what actually happened was...


Error details

    RuntimeError: LazySpecification has not been materialized yet (calling :required_ruby_version [])
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/gems/bundler-1.11.0/lib/bundler/lazy_specification.rb:75:in `method_missing'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/gems/bundler-1.11.0/lib/bundler/resolver.rb:132:in `for?'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/gems/bundler-1.11.0/lib/bundler/resolver.rb:275:in `block in search_for'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/gems/bundler-1.11.0/lib/bundler/resolver.rb:275:in `select'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/gems/bundler-1.11.0/lib/bundler/resolver.rb:275:in `search_for'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/gems/bundler-1.11.0/lib/bundler/resolver.rb:332:in `block in verify_gemfile_dependencies_are_found!'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/gems/bundler-1.11.0/lib/bundler/resolver.rb:330:in `each'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/gems/bundler-1.11.0/lib/bundler/resolver.rb:330:in `verify_gemfile_dependencies_are_found!'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/gems/bundler-1.11.0/lib/bundler/resolver.rb:199:in `start'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/gems/bundler-1.11.0/lib/bundler/resolver.rb:183:in `resolve'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/gems/bundler-1.11.0/lib/bundler/definition.rb:198:in `resolve'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/gems/bundler-1.11.0/lib/bundler/definition.rb:163:in `missing_specs'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/gems/bundler-1.11.0/lib/bundler/installer.rb:187:in `block in resolve_if_need'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/gems/bundler-1.11.0/lib/bundler/ui/shell.rb:80:in `silence'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/gems/bundler-1.11.0/lib/bundler/installer.rb:184:in `resolve_if_need'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/gems/bundler-1.11.0/lib/bundler/installer.rb:69:in `run'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/gems/bundler-1.11.0/lib/bundler/installer.rb:21:in `install'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/gems/bundler-1.11.0/lib/bundler/cli/install.rb:105:in `run'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/gems/bundler-1.11.0/lib/bundler/cli.rb:172:in `install'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/gems/bundler-1.11.0/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/gems/bundler-1.11.0/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/gems/bundler-1.11.0/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/gems/bundler-1.11.0/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/gems/bundler-1.11.0/lib/bundler/cli.rb:10:in `start'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/gems/bundler-1.11.0/exe/bundle:19:in `block in <top (required)>'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/gems/bundler-1.11.0/lib/bundler/friendly_errors.rb:7:in `with_friendly_errors'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/gems/bundler-1.11.0/exe/bundle:17:in `<top (required)>'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/bin/bundle:23:in `load'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/bin/bundle:23:in `<main>'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/bin/ruby_executable_hooks:15:in `eval'
      /home/ubuntu/.rvm/gems/ruby-2.1.7@global/bin/ruby_executable_hooks:15:in `<main>'

Environment

    Bundler   1.11.0
    Rubygems  2.4.8
    Ruby      2.1.7p400 (2015-08-18 revision 51632) [x86_64-linux]
    GEM_HOME  /home/ubuntu/applicationnamehere/vendor/bundle/ruby/2.1.0
    GEM_PATH  
    RVM       1.26.10 (1.26.10)
    Git       1.8.5.6

Bundler settings

    retry
      Set for your local app (/home/ubuntu/applicationnamehere/admin/.bundle/config): 3
    path
      Set for your local app (/home/ubuntu/applicationnamehere/admin/.bundle/config): "/home/ubuntu/applicationnamehere/vendor/bundle"
    jobs
      Set for your local app (/home/ubuntu/applicationnamehere/admin/.bundle/config): 4
    without
      Set for your local app (/home/ubuntu/applicationnamehere/admin/.bundle/config): "development"
    disable_shared_gems
      Set for your local app (/home/ubuntu/applicationnamehere/admin/.bundle/config): "1"
--- TEMPLATE END ----------------------------------------------------------------

Unfortunately, an unexpected error occurred, and Bundler cannot continue.

First, try this link to see if there are any existing issue reports for this error:
https://github.com/bundler/bundler/search?q=LazySpecification+has+not+been+materialized+yet+%28calling+%3Arequired_ruby_version+%5B%5D%29&type=Issues

If there aren't any reports for this error yet, please create copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at:
https://github.com/bundler/bundler/issues/new
./ci-build.rb:32:in `block in install': Cannot finish gem installation (RuntimeError)
	from ./ci-build.rb:122:in `chdir'
	from ./ci-build.rb:122:in `chdir'
	from ./ci-build.rb:31:in `install'
	from ./ci-build.rb:131:in `block in install'
	from ./ci-build.rb:129:in `each'
	from ./ci-build.rb:129:in `install'
	from ./ci-build.rb:208:in `run_cli'

./ci-build.rb install returned exit code 1

from ./ci-build.rb:221:in `<main>' Action failed: ./ci-build.rb install

After trying to add the following to our circleci.yml file under pre-dependencies:

gem uninstall bundler
gem install bundler -v 1.10.6

This error occurred on CircleCi.com

gem uninstall bundler
ERROR:  While executing gem ... (Gem::InstallError)
    bundler is not installed in GEM_HOME, try:

gem uninstall bundler returned exit code 1

gem uninstall -i /home/ubuntu/.rvm/gems/ruby-2.1.7@global bundler Action failed: gem uninstall bundler

Removing the uninstall and just doing an install of bundler v1.10.6 doesn’t help because 1.11.0 is still being used.

Any help is appreciated.

Your docs, https://circleci.com/docs/configuration#bundler, even say we should be able to use gem uninstall bundler, but it fails for us.

Had to specify the specific gem/gemset location -i /home/ubuntu/.rvm/gems/ruby-2.1.7@global and also add -x --force to forcibly remove any dependent executables.

full line:

gem uninstall -x --force -i /home/ubuntu/.rvm/gems/ruby-2.1.7@global bundler -v 1.11.0

2 Likes

Thank you very much for sharing this!

Having the same issue.

Also having this issue.

Getting the same error and the suggested workaround yields:

gem uninstall -x --force -i /home/ubuntu/.rvm/gems/ruby-2.1.7@global bundler -v 1.11.0
ERROR:  While executing gem ... (Gem::InstallError)

gem uninstall -x --force -i /home/ubuntu/.rvm/gems/ruby-2.1.7@global bundler -v 1.11.0 returned exit code 1

gem "bundler" is not installed Action failed: gem uninstall -x --force -i /home/ubuntu/.rvm/gems/ruby-2.1.7@global bundler -v 1.11.0

Had to do the following, if 1.11.0 was already installed.

if $(gem list bundler -v 1.11.0 -i); then gem uninstall -x -i /home/ubuntu/.rvm/gems/ruby-2.1.7@global bundler; fi

full dependencies, pre section is:

dependencies:
  pre:
    - if $(gem list bundler -v 1.11.0 -i); then gem uninstall -x -i /home/ubuntu/.rvm/gems/ruby-2.1.7@global bundler; fi
    - gem install bundler -v 1.10.6

Taking off --force worked.

1 Like

This, https://github.com/travis-ci/travis-ci/issues/5290#issuecomment-164600246, has actually been the cleanest thing I’ve tried (works on CircleCI also):

dependencies:
  pre:
    - rvm @global do gem uninstall bundler -a -x
    - rvm @global do gem install bundler -v 1.10.6
1 Like

Hi everyone. I’m the Bundler team lead. I just wanted to chime in with a couple of other options:

  1. You can force a gem version using underscores, like this: bundle _1.10.6_ install. If you don’t have an older version installed, install it first and then use the underscores:

    gem install bundler -v 1.10.6
    bundle 1.10.6 install

That way you don’t have to uninstall anything.

  1. You can upgrade to Bundler 1.11.1, which has a fix for the problem. :smile:

    gem install bundler

In the future, it would help so much if more people would test prerelease versions of Bundler. We shipped the first 1.11 prerelease almost three weeks ago, fixed every bug report, and then waited an additional week before shipping 1.11 final. With more prerelease testers, we could have avoided this completely! Follow @bundlerio on twitter, or use Gymnasium, or subscribe to the RSS feed at rubygems.org/gems/bundler to get notifications when there are new versions.

3 Likes

@indirect I will definitely look at helping with pre-releases now. Thank you for the information.

Please note that 1.11.1 still has the error. It is not a fix. As stated here it seems 1.11.2 has it. I haven’t tested yet. I have verified that 1.11.1 does not have it.

@indirect just realized I linked you to your own github comment :smile: thank you for working so hard on Bundler and helping us make our software better. Wish all users understood you are all human like the rest of us and trying to predict all usages in all environments is impossible without community support. :beers:

2 Likes

I was able to remove all of my dependencies, pre stuff regarding bundler. 1.11.2 works great and if you rebuild without cache your circleci builds will use it by default.

1 Like