2

I just tried deploying my app to Heroku. It's been working for quite a while, I am just adding some new features. Once I deployed, I got an "App Crashed" error. heroku logs showed No such file to load -- nokogiri (LoadError).

Now, on my system, my Gemfile.lock showed 2 different nokogiri gems: nokogiri (~> 1.5.0), a dependency of fog (1.4.0) and nokogiri (1.5.5-x86-mingw32) which doesn't appear to be a dependency of anything. Under platforms was only x86-mingw32. My development computer is Windows 7 with ruby 1.9.3p194 and the Ruby version that the Heroku toolbalt uses for itself is heroku-toolbelt/2.30.1 (i386-mingw32) ruby/1.9.2.

My version of Bundler was up to date, my version of the Heroku toolbelt was up to date. I tried deleting Gemfile.lock and re-deploying on the advice of some forum posts, but the app was still crashed.

It appears that Heroku was simply not bundling in the right version of nokogiri, but was ignoring it on account of my use of Windows. The way I got to to be fixed was I added gem 'nokogiri', '~> 1.5.5' to my gemfile (even though my app does not explicitly need nokogiri, it is only a dependency) and then re-deployed to Heroku without running bundle install on my own system first. Now the app does not crash.

I have no idea why this worked. I don't know how to ensure the problem doesn't occur again, I just happened to get lucky with a desperate patch. I can't have this downtime in the future, or worry about something like this happening again for a routine deploy. Can someone please explain what was actually wrong and the right way to solve it?

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
John
  • 3,430
  • 2
  • 31
  • 44
  • There are just lots of crazy gem issues when using Heroku from Windows. See the answers in this question: http://stackoverflow.com/questions/5954236/why-wont-heroku-accept-my-gemfile-lock-in-windows – Qsario Aug 01 '12 at 07:10
  • This isn't helpful. Heroku offers a Windows toolbelt, so it should work on Windows. In fact, it *has* worked on Windows for a very long time, but it suddenly isn't working now, and I'm looking for answers as to how to fix it. – John Aug 01 '12 at 22:13
  • It's a bundler issue: it sometimes creates different Gemfile.lock files on different platforms when the dependencies are different (your first clue was that Heroku has no need for mingw). You can take that up with Herkou support or you can deploy from a Unix VM, but I don't know of other solutions. Windows is still a second-tier platform (at best) for Ruby/Rails. And I say this as someone who bought a dev laptop for that very reason. You're better off with production and dev being mirrors of each other, anyhow. – Qsario Aug 01 '12 at 22:34

1 Answers1

0

Add this

 PLATFORMS
    x86-mingw32

to your Gemfile. Heroku will then ignore your Gemfile.lock because windows has crazy different dependencies.

Eric Fode
  • 3,667
  • 2
  • 24
  • 29