Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundle fails on install #41

Closed
AspenJames opened this issue Jan 8, 2019 · 3 comments · Fixed by #42
Closed

Bundle fails on install #41

AspenJames opened this issue Jan 8, 2019 · 3 comments · Fixed by #42
Labels

Comments

@AspenJames
Copy link
Contributor

AspenJames commented Jan 8, 2019

Bundle fails on install

Expected Behavior

bundle or bundle install installs dependencies

Observed Behavior

bundle or bundle install fails with incompatible version

// ♥ bundle
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Bundler could not find compatible versions for gem "bundler":
  In Gemfile:
    rails (= 4.2) was resolved to 4.2.0, which depends on
      bundler (>= 1.3.0, < 2.0)

  Current Bundler version:
    bundler (2.0.1)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?

Could not find gem 'bundler (>= 1.3.0, < 2.0)', which is required by gem 'rails (= 4.2)', in
any of the sources.

Cause

Breaking changes in Bundler v2.0

One of the features of Bundler v2.0 is version is "version autoswitching", which you can read about here. This feature requires a Gemfile.lock to be committed into VC, and the Gemfile.lock is currently .gitignored.

Remedy

Check in Gemfile.lock to git. Output below shown on commit c853032, which was immediately prior to Gemfile.lock being removed from git:

[16:05:51] ((HEAD detached at c853032)) model-class-methods-lab-v-000
// ♥ bundle
Fetching gem metadata from https://rubygems.org/..........
======
snip
======
Bundle complete! 12 Gemfile dependencies, 62 gems now installed.

#Staff

@AspenJames
Copy link
Contributor Author

AspenJames commented Jan 8, 2019

Important!

This will affect all labs without a Gemfile.lock checked into git wherein a dependency depends on bundler, < 2.0

@heavenlyboheme
Copy link

Gemfile.lock is created after running "bundle install" in the terminal.

@AspenJames
Copy link
Contributor Author

AspenJames commented Jan 15, 2019

Yes, this is true. What I'm referencing above is a unique failure where a breaking change in Bundler v.2.0 is causing bundle install to fail. A Gemfile.lock file is necessary for the auto-version switching to happen. Since it's not there to begin with, the autoswitching doesn't occur, the dep install fails, and no lockfile is created. We've observed this issue in several students' environments, and while there is a workaround, adding a lockfile is a solution that prevents the failure from ever happening.

Edit: In order to replicate the issue, you will need Bundler v2.0.x installed globally

maxwellbenton added a commit that referenced this issue Jan 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@heavenlyboheme @AspenJames and others