Skip to content

Basic Bundler operations don't seem to work on Windows #209

Description

@chrisseaton

I have a basic gem. Its CI looks like this.

https://github.com/Shopify/seafoam/blob/master/.github/workflows/workflows.yml

I enabled Windows, and there even a basic bundle exec rspec doesn't work on Windows.

Shopify/seafoam@9ef19e5

https://github.com/Shopify/seafoam/runs/3186334852

I found this in a more complex gem, but I'm reproducing here to make the problem more clear in simpler code. That gem does bundle exec rake, so it's not a Rake / RSpec thing.

Activity

  1. MSP-Greg commented on Jul 28, 2021

    @MSP-Greg
    Collaborator

    @chrisseaton

    Not sure what the issue is. YARD uses rspec (the only repo I immediately thought of), and it's using Bundler 2 and a rake task.

    I looked at the branch you added Windows CI to. You might add quotes around the 3.0 version in the workflow file, as it's interpreted as '3' by the parser. So, when Ruby 3.1 is released, it will jump to that... Also, personal preference, but '-latest` for OS designation may change, which you may not want...

  2. eregon commented on Jul 29, 2021

    @eregon
    Member

    https://github.com/Shopify/seafoam/runs/3186334964#step:3:22

    Setting BUNDLER_VERSION=1.17.2 for "bundle config|lock" commands below to ensure Bundler 1 is used

    Can you try by removing the BUNDLE WITH section in https://github.com/Shopify/seafoam/blob/722a029eb268c3e00d8a946c5f554ad0b28e265f/Gemfile.lock#L58-L59, or updating to 2.x with bundle update --bundler?

    If that's not it, I suspect a potential regression in Bundler.

    But should definitely make sure Bundler 2 is used first, Bundler 1 is no longer being developed and might not work with recent Rubies AFAIK.

  3. eregon commented on Jul 29, 2021

    @eregon
    Member

    Note that bundle exec rake --version does work in this repo's CI:
    https://github.com/ruby/setup-ruby/runs/3171185439#step:17:10

    I think the problem is there is no Rakefile in https://github.com/Shopify/seafoam/tree/windows-ci
    Also rake has some nasty exception/backtrace swallowing, some of it got recently fixed: ruby/rake#367

  4. chrisseaton commented on Jul 29, 2021

    @chrisseaton
    Author

    Note that bundle exec rake --version does work

    Yes in my other repo it actually finds rake, starts to run it, then during the load of Gems it then complains rake isn't installed! I get backtraces like this

    C:/hostedtoolcache/windows/Ruby/2.7.1/x64/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/rubygems_integration.rb:374:in `block in replace_bin_path': 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? (Gem::Exception)
    	from C:/hostedtoolcache/windows/Ruby/2.7.1/x64/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/rubygems_integration.rb:402:in `block in replace_bin_path'
    	from D:/a/shopify-cli/shopify-cli/vendor/bundle/ruby/2.7.0/bin/rake:23:in `<main>'
    

    I think the problem is there is no Rakefile

    Does Bundler need a Rakefile to run? It doesn't in macOS or Ubuntu.

  5. chrisseaton commented on Jul 29, 2021

    @chrisseaton
    Author

    I think the problem is there is no Rakefile

    I don't think it's using Rake or not. I added a Rakefile, and same issue.

    Shopify/seafoam@5667055

    https://github.com/Shopify/seafoam/runs/3191396713#step:4:11

    C:/hostedtoolcache/windows/Ruby/2.7.4/x64/lib/ruby/gems/2.7.0/gems/bundler-1.17.2/lib/bundler/rubygems_integration.rb:462:in `block in replace_bin_path': 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? (Gem::Exception)
    	from C:/hostedtoolcache/windows/Ruby/2.7.4/x64/lib/ruby/gems/2.7.0/gems/bundler-1.17.2/lib/bundler/rubygems_integration.rb:482:in `block in replace_bin_path'
    	from D:/a/seafoam/seafoam/vendor/bundle/ruby/2.7.0/bin/rake:23:in `<main>'
    
  6. chrisseaton commented on Jul 29, 2021

    @chrisseaton
    Author

    It is fixed by upgrading to most recent Bundler though, so I'll investigate in that direction.

  7. chrisseaton commented on Jul 29, 2021

    @chrisseaton
    Author

    It does work with 2.2.17, but doesn't work with 2.1.4. I'm not going to bisect that further, but that's the fix - you need to use a more recent Bundler on Windows than you do on other platforms, and it needs to be at least I guess 2.2 or so.

    I don't know if that needs to be documented, or tested for, or something like that.

  8. eregon commented on Jul 29, 2021

    @eregon
    Member

    I added bundle exec rake in this repo CI, and it passes for everything except JRuby on Windows, which is a known bug: e08bf35 #18 (comment)

    Does Bundler need a Rakefile to run? It doesn't in macOS or Ubuntu.

    rake certainly does. The error might just be confusing or the wrong one, but that's just a guess.

  9. eregon commented on Jul 29, 2021

    @eregon
    Member

    Documented in 77d7ca9.

  10. chrisseaton commented on Jul 29, 2021

    @chrisseaton
    Author

    rake certainly does

    I don't run rake though.

  11. eregon commented on Jul 29, 2021

    @eregon
    Member

    ^ indeed, my bad, I was confusing with some other log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions