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

Gemfile.lock built with Bundler 2.2.x fails #1106

Closed
2 of 3 tasks
schneems opened this issue Jan 11, 2021 · 6 comments
Closed
2 of 3 tasks

Gemfile.lock built with Bundler 2.2.x fails #1106

schneems opened this issue Jan 11, 2021 · 6 comments

Comments

@schneems
Copy link
Contributor

schneems commented Jan 11, 2021

From rubygems/rubygems#4269

Describe the problem as clearly as you can

Here's an example repo: https://github.com/schneems/bundler_223_fails_deploy. It has one dependency rake and the Gemfile.lock was generated by running bundle install on my mac. When I try to use this Gemfile/Gemfile.lock combo it fails:

docker run -it --rm ruby:2.7 bash
git clone https://github.com/schneems/bundler_223_fails_deploy
cd bundler_223_fails_deploy
export BUNDLE_WITHOUT='development:test'
export BUNDLE_DEPLOYMENT=1
export BUNDLE_PATH=vendor/bundle
bundle install -j4

Then

 bundle exec rake -P
bundler: failed to load command: rake (/bundler_223_fails_deploy/vendor/bundle/ruby/2.7.0/bin/rake)
Gem::Exception: can't find executable rake for gem rake. rake is not currently included in the bundle, perhaps you meant to add it to your Gemfile?
  /usr/local/lib/ruby/2.7.0/bundler/rubygems_integration.rb:374:in `block in replace_bin_path'
  /usr/local/lib/ruby/2.7.0/bundler/rubygems_integration.rb:402:in `block in replace_bin_path'
  /bundler_223_fails_deploy/vendor/bundle/ruby/2.7.0/bin/rake:23:in `<top (required)>'

What were you expecting to happen?

I expect that a Gemfile.lock produced on mac can also work on linux

What actually happened?

The gem appears to install, but then it cannot be loaded.

Extra context

Either adding ruby to the PLATFORMS section or x86_64-linux fixes the issue, but this is not immediately clear.

If not included with the output of your command, run bundle env and paste the output below

bundle env (on my mac) ## Environment
Bundler       2.2.3
  Platforms   ruby, x86_64-darwin-19
Ruby          3.0.0p0 (2020-12-25 revision 95aff214687a5e12c3eb57d056665741e734c188) [x86_64-darwin19]
  Full Path   /Users/rschneeman/.rubies/ruby-3.0.0/bin/ruby
  Config Dir  /Users/rschneeman/.rubies/ruby-3.0.0/etc
RubyGems      3.2.3
  Gem Home    /Users/rschneeman/.gem/ruby/3.0.0
  Gem Path    /Users/rschneeman/.gem/ruby/3.0.0:/Users/rschneeman/.rubies/ruby-3.0.0/lib/ruby/gems/3.0.0
  User Home   /Users/rschneeman
  User Path   /Users/rschneeman/.gem/ruby/3.0.0
  Bin Dir     /Users/rschneeman/.gem/ruby/3.0.0/bin
Tools         
  Git         2.28.0
  RVM         not installed
  rbenv       not installed
  chruby      0.3.9

Bundler Build Metadata

Built At          2020-12-22
Git SHA           29dc3c8398
Released Version  true

Bundler settings

jobs
  Set for the current user (/Users/rschneeman/.bundle/config): 8
build.nokogiri
  Set for the current user (/Users/rschneeman/.bundle/config): "--use-system-libraries"
gem.test
  Set for the current user (/Users/rschneeman/.bundle/config): "rspec"
gem.mit
  Set for the current user (/Users/rschneeman/.bundle/config): true
gem.coc
  Set for the current user (/Users/rschneeman/.bundle/config): true
--path
  Set for the current user (/Users/rschneeman/.bundle/config): "vendor/"

Gemfile

Gemfile

source 'https://rubygems.org'
gem 'rake'

Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    rake (13.0.3)

PLATFORMS
  x86_64-darwin-19

DEPENDENCIES
  rake

BUNDLED WITH
   2.2.3
bundle env (on docker) ## Environment
Bundler       2.1.4
  Platforms   ruby, x86_64-linux
Ruby          2.7.2p137 (2020-10-01 revision 5445e0435260b449decf2ac16f9d09bae3cafe72) [x86_64-linux]
  Full Path   /usr/local/bin/ruby
  Config Dir  /usr/local/etc
RubyGems      3.1.4
  Gem Home    /usr/local/bundle
  Gem Path    /root/.gem/ruby/2.7.0:/usr/local/lib/ruby/gems/2.7.0:/usr/local/bundle
  User Home   /root
  User Path   /root/.gem/ruby/2.7.0
  Bin Dir     /usr/local/bundle/bin
Tools
  Git         2.20.1
  RVM         not installed
  rbenv       not installed
  chruby      not installed

Bundler Build Metadata

Built At          2021-01-11
Git SHA           unknown
Released Version  false

Bundler settings

jobs
  Set for your local app (/usr/local/bundle/config): 4
without
  Set for your local app (/usr/local/bundle/config): [:development, :test]
  Set via BUNDLE_WITHOUT: [:development, :test]
app_config
  Set via BUNDLE_APP_CONFIG: "/usr/local/bundle"
deployment
  Set via BUNDLE_DEPLOYMENT: true
silence_root_warning
  Set via BUNDLE_SILENCE_ROOT_WARNING: true
path
  Set via BUNDLE_PATH: "vendor/bundle"

Gemfile

Gemfile

source 'https://rubygems.org'
gem 'rake'

Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    rake (13.0.3)

PLATFORMS
  x86_64-darwin-19

DEPENDENCIES
  rake

BUNDLED WITH
   2.2.3

Remediation

  • Responding to all support tickets that they should try to manually "lock" their platform to include a Linux target:
$ bundle lock --add-platform x86_64-linux --add-platform ruby
$ bundle install
$ git add . ; git commit -m "Bundler fix"

Linked tickets:

@johlym
Copy link

johlym commented Jan 12, 2021

@schneems 949406 to your list.

@johlym
Copy link

johlym commented Jan 12, 2021

My vote is to push for a fix upstream; this wouldn't inherently be an issue unique to Heroku, I would think. Anyone that develops on a Mac (x86_64|arm*-darwin-nn), for example, and pushes to any Linux box would run into this, wouldn't they?

Alternatively, a wilder idea still would be to shim the Linux platform string into Gemfile.lock with a message that we have to do so because of bundler changes.

@meltingice
Copy link

I am running into this issue now as well, so glad I found this thread. I am developing on a Mac, deploying to Heroku. I tried adding x86_64-linux to the platforms but it didn't work. Only after adding ruby did it succeed.

Bundler             2.2.4
  Platforms         ruby, x86_64-darwin-20
Ruby                2.7.2p137 (2020-10-01 revision 5445e0435260b449decf2ac16f9d09bae3cafe72) [x86_64-darwin20]
  Full Path         /Users/ryanlefevre/.rvm/rubies/ruby-2.7.2/bin/ruby
  Config Dir        /Users/ryanlefevre/.rvm/rubies/ruby-2.7.2/etc
RubyGems            3.1.4
  Gem Home          /Users/ryanlefevre/.rvm/gems/ruby-2.7.2
  Gem Path          /Users/ryanlefevre/.rvm/gems/ruby-2.7.2:/Users/ryanlefevre/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0
  User Home         /Users/ryanlefevre
  User Path         /Users/ryanlefevre/.gem/ruby/2.7.0
  Bin Dir           /Users/ryanlefevre/.rvm/gems/ruby-2.7.2/bin
Tools               
  Git               2.24.3 (Apple Git-128)
  RVM               1.29.11 (latest)
  rbenv             not installed
  chruby            not installed
  rubygems-bundler  (1.4.5)

@schneems
Copy link
Contributor Author

Update on the conversation: rubygems/rubygems#4269 (comment)

@schneems
Copy link
Contributor Author

@meltingice I updated the docs to recommend both "Linux" and "ruby" incantations to --add-platform

@schneems schneems changed the title Gemfile.lock built with Bundler 2.2.3 fails Gemfile.lock built with Bundler 2.2.x fails Jan 27, 2021
@oakbow
Copy link

oakbow commented Apr 11, 2021

Hi there!

I had same issue but resolved with following way.

  1. run bundle update --bundler... upgrading bundler from 2.2.2 to 2.2.16
  2. run bundle lock --remove-platform x86_64-darwin-19

please replace the platform name with the one in your Gemfile.lock

with bundler 2.2.2 my PLATFORMS in my Gemfile.lock was ruby and x86_64-darwin-19.
I guess this setting was invalid and caused to install wrong nokogiri platform version.
after 2 bundler commands above, it installs numbered version instead of platform version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants