12

I have a rails application that I deploy on Heroku. I'm using several different machines, and I noticed that when I add new dependencies (so that Gemfile.lock is rebuilt) and do bundle install on my Windows computer at home, push to Heroku fails with the following error:

   Unresolved dependencies detected; Installing...
   Windows Gemfile.lock detected, ignoring it.
   You have modified your Gemfile in development but did not check
   the resulting snapshot (Gemfile.lock) into version control
   ...

Gemfile.lock IS under version control, but Heroku appearently chooses to ignore it since it's created in Windows, and then complains that it's missing seconds later. Why does this happen? And how can I solve it?

mranders
  • 1,790
  • 2
  • 17
  • 31
  • Something to do with CR/LF on Windows vs *nix? – Caley Woods May 10 '11 at 20:17
  • Maybe? Judging from the output from the failed push, it looks like Heroku is deliberately ignoring it. – mranders May 10 '11 at 21:19
  • Is bundler perhaps choosing precompiled windows binaries as dependencies and listing them in `Gemfile.lock`? – matt May 10 '11 at 21:37
  • 1
    Have a look at the question "Does Bundler work on Windows?" here: http://www.engineyard.com/blog/2011/bundler-pro-tip/ it looks like it could be related to your problem. – matt May 10 '11 at 21:46

5 Answers5

24

I fixed mine by opening Gemfile.lock and deleting the following two lines:

PLATFORMS
  x86-mingw32

So now i just need to make a script that bundles then removes that from the lock file.

9

Like matt commented above:

The problem is that Bundler creates different Gemfile.locks for Windows. The only solution is to create and commit the lock file on a *NIX system.

I would suggest to create a virtual machine running e.g. Ubuntu – maybe using Virtual Box. You can even get ready-to-use virtual machines – for example here.

Koraktor
  • 41,357
  • 10
  • 69
  • 99
  • 3
    Is there really no other way? That's pretty absurd. The Heroku folks should at least have this in their docs. I couldn't find anything about it. Thank you very much for the answer - it cleared things up! – mranders May 11 '11 at 12:57
  • I just had same issue, still nothing in the documents. Very odd, and does make it look like heroku just isn't interested in windows users using their service. – Colin Jack Jul 23 '11 at 22:30
  • and this is the reason i don't use linux very often. there's a million ways to do things, and if you don't pick the right way then you're screwed.. no standards amongst developers. – Josh O'Bryan May 17 '12 at 05:28
4

From the Heroku Docs:

If the platforms section of your Gemfile contains Windows entries, such as mswin or mingw, then the Gemfile.lock file will be ignored.

lambinator
  • 10,616
  • 7
  • 55
  • 57
  • This helped me. Had a Sqlite3 gem listed that was a mingw version, luckily it could be removed since i'm not using sqlite – JCherryhomes Apr 04 '12 at 03:48
0

Just battled through this problem for a while.

I trimmed my gemfile back to just rails and still had the issue. Then, thinking that heroku had demanded an update of the heroku gem today, I looked closer at heroku changes.

It seems the 1.9.2 ruby "bamboo" stack is now the default one - my app is still running on the 1.8.7 stack. So I ran "heroku stack:migrate bamboo-mri-1.9.2" and updated the stack to 1.9.2 - not something I wanted to do, but you know what, it fixed the issue above.

Of course, I didn't want to be on the 1.9.2 stack, so I migrated back down to the 1.8.7 stack, and things installed correctly again. So I think this is a workaround - and probably an overly complex one - but it seemed to "flush" whatever the error was heroku-side. As nothing I did locally (and I tried a LOT of things from StackOverflow articles) had any effect, the push just kept failing as above.

So yeah, this fixes it. Doesn't take too long either. But suspect a better workaround may be spotted by more heroku-knowledgeable developers !

Phantomwhale
  • 1,789
  • 1
  • 16
  • 30
  • Just got this issue again. Googled around. No answer fixed it - then ran through this before I even realised I was following my own post ! So yeah, still a mystery to me, but this is the only cure I could find to dodgy Gemfile.lock compliants... – Phantomwhale Nov 03 '11 at 11:18
-1

Make sure you commit the changes to Gemfile.lock after installing the bundle. On your next push to Heroku, the new gems should be installed correctly.

David Sulc
  • 25,946
  • 3
  • 52
  • 54