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?