Martin Han
2010-Jun-10 00:25 UTC
[Rails] strange problem:no such file to load -- nokogiri on rails3
I am test the script named test.rb by command "ruby test.rb" and it pass. Then i converte it as rake task. The rake task pass on rails 2.3.4 but fail on rails 3 beta4 with error msg: "no such file to load -- nokogiri" ===========================env :rails 3 beta4, ruby 1.8.7, ubuntu ===========================test.rb ===========================require ''rubygems'' require ''nokogiri'' require ''open-uri'' require "iconv" url = "http://www.bugutang.com" doc = Nokogiri::HTML(open(url)) doc.css("title").each do |c| puts Iconv.iconv("GBK//IGNORE", "UTF-8//IGNORE", c.content) end ===========================claw.rake ===========================desc "Fetch product " task :claw => :environment do require ''rubygems'' require ''nokogiri'' require ''open-uri'' require "iconv" url = "http://www.bugutang.com" doc = Nokogiri::HTML(open(url)) doc.css("title").each do |c| puts Iconv.iconv("GBK//IGNORE", "UTF-8//IGNORE", c.content) end end ===========================here is the environment : RubyGems Environment: - RUBYGEMS VERSION: 1.3.7 - RUBY VERSION: 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux] - INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8 - RUBY EXECUTABLE: /usr/bin/ruby1.8 - EXECUTABLE DIRECTORY: /usr/bin - RUBYGEMS PLATFORMS: - ruby - x86_64-linux - GEM PATHS: - /usr/lib/ruby/gems/1.8 - /home/bugu/.gem/ruby/1.8 - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :benchmark => false - :backtrace => false - :bulk_threshold => 1000 - REMOTE SOURCES: - http://rubygems.org/ *** LOCAL GEMS *** nokogiri (1.4.2) Authors: Aaron Patterson, Mike Dalessio Rubyforge: http://rubyforge.org/projects/nokogiri Homepage: http://nokogiri.org Installed at: /usr/lib/ruby/gems/1.8 Is it one bug on Rails 3 beta ? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Reasonably Related Threads
- Loading xml document using Nokogiri and retrieving CDATA element
- Why the string interpolation is not working inside the Nokogiri method `#search` ?
- Nokogiri::XML methods example
- nokogiri: parsing tags
- `require': cannot load such file -- nokogiri (LoadError) in rubyXL