Skip to content

Bundler 2.2.3 generated Gemfile.lock on a mac cannot be used on linux out of the box #4269

@schneems

Description

@schneems

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions