问题
I had a working app, added Nokogiri, to parse some xml, runs fine locally.
My Gemfile includes: gem 'nokogiri'
I ran bundle install
and verified my Gemfile.lock includes DEPENDENCIES
... nokogiri
In my controller class I added (didnt thinkI had to but got an error locally if I didnt):
class MydealController < ApplicationController
require 'rubygems'
require 'open-uri'
require 'nokogiri'
when I use my browser to get the url in MydealController that uses nokogiri doc = Nokogiri::XML(getresult)
Heroku crashes.
heroku logs
shows this error No such file to load -- nokogiri (LoadError)
Looking at what happens when I git push heroku
I do not see nokogiri on the list of many many gems that get installed. Heroku says the push was fine, but nokogiri is not listed and I get the aforementioned error...
回答1:
It seems that when using Windows Gemfile.lock
will contain version of nokogiri
gem specific for windows, solution is to remove Gemfile.lock and push to heroku.
More info on this subject here
回答2:
Your mission should you choose to accept it.
Ensure:
- nokogiri is in Gemfile.lock
- Gemfile.lock is committed to git
- you push the commit that has nokogiri in Gemfile.lock to Heroku
Good luck! This message will self destruct in 10 seconds...
回答3:
Just had the same problem -- you have to run bundle install
to get it added to the Gemfile.lock
which heroku looks at to find uninstalled dependencies.
回答4:
This might help to understand the reason: http://devcenter.heroku.com/articles/ps
Indeed removing Gemfile.lock might help. All other compiled gem will cause isseu. Best way is to ask Heroku's support.
Only found this article: http://ganeshprasadsr.blogspot.com/2010/10/installing-nokogiri-for-rails-3-app-on.html
回答5:
Try to remove require 'nokogiri'
from controller.
It works for me.
来源:https://stackoverflow.com/questions/4964800/heroku-app-crashes-logs-say-no-such-file-to-load-nokogiri-loaderror