加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – 没有要加载的文件 – active_support / core_e

发布时间:2020-12-17 03:19:39 所属栏目:百科 来源:网络整理
导读:在我的rails 2.3.8应用程序在 Windows 7中运行,尝试启动服务器时出现以下错误: D:app1ruby script/serverC:/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 (Lo
在我的rails 2.3.8应用程序在 Windows 7中运行,尝试启动服务器时出现以下错误:

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 path”

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)

看看部分错误,但我不太清楚从哪里开始.

解决方法

创建一个文件名

core_ext.rb

在里面

C:Rubylibrubygems1.8gemsactivesupport-2.3.8libactive_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}" }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读