27

I'm building a rails site on a Windows machine but when I check in my Gemfile.lock I get the following error on my Travis builds:

Your bundle only supports platforms ["x86-mingw32"] but your local platforms are ["ruby", "x86_64-linux"], and there's no compatible match between those two

lists

Here is the full log: https://travis-ci.org/bikebike/BikeBike/builds/222395810#L654

I looked at my Gemfile.lock and it states:

PLATFORMS
  x86-mingw32

Which appears to be part of the issue. I've tried putting any windows specific gems in a platforms block:

platforms 'mswin', 'mingw', 'mswin64', 'x64_mingw' do
  gem 'tzinfo-data'

  group :test do
    gem 'wdm', '>= 0.1.0'
    gem 'win32console', require: false
  end
end

But the Gemfile.lock looks the same.

Here is my full Gemfile and Gemfile.lock.

I can temporarily get around the issue by removing the Gemfile.lock file from git but this is not best practice. Is there anyway that I can commit my Gemfile.lock file and continue to develop on my Windows machine?

Godwin
  • 9,739
  • 6
  • 40
  • 58

2 Answers2

59

Run the following two commands on the command line:

bundle lock --add-platform ruby
bundle lock --add-platform x86_64-linux

This will add the two platforms in Gemfile.lock

I had the same error when deploying to google cloud. But after running these two commands ruby and x86_64-linux were added and the issue was resolved.

taz
  • 591
  • 3
  • 4
  • this worked for me. i accidentally deleted the linux line after migrating away from PopOS, which broke my AWS deployment, and the 2nd command here fixed it – aidan May 10 '22 at 20:17
6

For Ruby 2.5.1 I solved this on my VPS by adding also the platforms mentioned in the error message to the platform list section of the gemfile.lock:

PLATFORMS
  x86-mingw32
  ruby 
  x86_64-linux

Only then, running following commands from app's directory (as already shown in taz's answer)

bundle lock --add-platform ruby
bundle lock --add-platform x86_64-linux

lead to success.

colidyre
  • 4,170
  • 12
  • 37
  • 53
Reco Daley
  • 99
  • 3
  • 4
  • The answer you referred did NOT work for me so I posted exactly what made my app work. It was also required that I edited the platform list @colidyre – Reco Daley Sep 07 '18 at 10:34
  • This worked and I didn't need to run the two commands you mentioned. – Jake Jul 03 '19 at 00:06