2011-01-31 87 views
5

在我的Rails 2.3.8應用程序在Windows 7上運行,讓試圖啓動服務器時出現以下錯誤:沒有這樣的文件來加載 - active_support/core_ext(LoadError)

D:\app1>ruby script/server 
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require': no such file to load -- active_support/core_ext (LoadError) 
     from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require' 
     from D:/app1/vendor/rails/activesupport/lib/active_support.rb:56 
     from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' 
     from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' 
     from D:/app1/vendor/rails/railties/lib/commands/server.rb:1 
     from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' 
     from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' 
     from script/server:3 

在自定義要求下面的文件塊......第36行是 「gem_original_require路徑」

def require(path) # :doc: 
    gem_original_require path 
    rescue LoadError => load_error 
    if load_error.message =~ /#{Regexp.escape path}\z/ and 
     spec = Gem.searcher.find(path) then 
     Gem.activate(spec.name, "= #{spec.version}") 
     gem_original_require path 
    else 
     raise load_error 
    end 
    end 

寶石名單如下:

actionmailer (2.3.8) 
actionpack (2.3.8) 
activerecord (2.3.8) 
activeresource (2.3.8) 
activesupport (2.3.8) 
builder (3.0.0) 
calendar_date_select (1.16.1) 
cgi_multipart_eof_fix (2.5.0) 
gem_plugin (0.2.3) 
google4r-checkout (1.0.6.1) 
i18n (0.5.0) 
liquid (2.2.2) 
money (3.5.5) 
mongrel (1.1.5 x86-mingw32) 
mysql (2.8.1 x86-mingw32) 
rack (1.1.0) 
rails (2.3.8) 
rake (0.8.7) 
rmagick (2.12.0 mswin32) 

看着周圍有部分錯誤,但我不確定從哪裏開始。

回答

1

創建一個文件名

core_ext.rb

C:\Ruby\lib\ruby\gems\1.8\gems\activesupport-2.3.8\lib\active_support 

和編輯的內容添加到下面的行

filenames = Dir["#{File.dirname(__FILE__)}/core_ext/*.rb"].sort.map do |path| 
    File.basename(path, '.rb') 
end 

# deprecated 
filenames -= %w(blank) 

filenames.each { |filename| require "active_support/core_ext/#{filename}" } 
+0

該目錄已經與您提供的確切內容具有相同的文件。謝謝你的嘗試。 – Jay 2011-01-31 20:51:01

5

看着堆棧跟蹤...它看起來像你的應用程序在驅動器「D」上,紅寶石文件在驅動器「C」上。

也許當它的執行需要

filenames = Dir["#{File.dirname(__FILE__)}/core_ext/*.rb"].sort.map do |path| 
    File.basename(path, '.rb') 
end 

其要求的「d」時,它應該是「C」這條道路。這是我最好的猜測。祝你好運。

+0

這是很久以前,我沒有機器,錯誤是在+1上創建的可能的解決方案...我相信它會幫助別人。 – Jay 2012-06-11 20:46:39

相關問題