在Windows上首次运行Rails:ERROR ArgumentError:符号的转储格式错误(0x6)

时间:2011-11-16 10:49:15

标签: ruby-on-rails ruby

我在Ruby on Rails上采取了我的第一个尝试性步骤。我试图在Windows机器上运行它(Win7 64)。我使用RubyInstaller安装,然后使用Gem安装Rails。

由于缺少宝石,不得不安装devkit等,我有点噩梦。这对于那些不知道他们正在做什么的人来说非常有趣。

无论如何,我终于到了一个可以运行一个新的"空的" rails项目,我希望看到默认的rails页面。

不幸的是,我在日志中遇到了内部服务器错误和以下内容:

[2011-11-16 10:30:56] INFO  WEBrick 1.3.1
[2011-11-16 10:30:56] INFO  ruby 1.9.3 (2011-10-30) [i386-mingw32]
[2011-11-16 10:30:56] INFO  WEBrick::HTTPServer#start: pid=3432 port=3000
[2011-11-16 10:31:19] ERROR ArgumentError: dump format error for symbol(0x6)
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.2.rc2/lib/action_view/template.rb:24:in `load'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.2.rc2/lib/action_view/template.rb:24:in `<top (required)>'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/coffee-rails-3.1.1/lib/coffee/rails/template_handler.rb:17:in `block in <top (required)>'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.1.2.rc2/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.1.2.rc2/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.1.2.rc2/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.1.2.rc2/lib/active_support/lazy_load_hooks.rb:42:in `each'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.1.2.rc2/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.2.rc2/lib/action_view/base.rb:216:in `<class:Base>'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.2.rc2/lib/action_view/base.rb:133:in `<module:ActionView>'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.2.rc2/lib/action_view/base.rb:8:in `<top (required)>'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.2.rc2/lib/abstract_controller/view_paths.rb:90:in `view_paths='
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.2.rc2/lib/abstract_controller/view_paths.rb:76:in `prepend_view_path'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.1.2.rc2/lib/rails/engine.rb:532:in `block (2 levels) in <class:Engine>'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.1.2.rc2/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.1.2.rc2/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.1.2.rc2/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.1.2.rc2/lib/active_support/lazy_load_hooks.rb:42:in `each'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.1.2.rc2/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.2.rc2/lib/action_controller/base.rb:234:in `<class:Base>'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.2.rc2/lib/action_controller/base.rb:171:in `<module:ActionController>'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.2.rc2/lib/action_controller/base.rb:3:in `<top (required)>'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.2.rc2/lib/action_dispatch/middleware/static.rb:31:in `ext'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.2.rc2/lib/action_dispatch/middleware/static.rb:15:in `match?'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.2.rc2/lib/action_dispatch/middleware/static.rb:47:in `call'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.1.2.rc2/lib/rails/engine.rb:456:in `call'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.3.5/lib/rack/content_length.rb:14:in `call'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.1.2.rc2/lib/rails/rack/log_tailer.rb:14:in `call'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.3.5/lib/rack/handler/webrick.rb:59:in `service'
    C:/Ruby193/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
    C:/Ruby193/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
    C:/Ruby193/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'

抛出错误的行是&#34; conversions = Marshal.load(File.read(filename))&#34;在以下代码块中:

if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ruby' && RUBY_VERSION == '1.9.3' && RUBY_PATCHLEVEL == 0
  # This is a hack to work around a bug in Ruby 1.9.3p0:
  # http://redmine.ruby-lang.org/issues/5564
  #
  # Basically, at runtime we may need to perform some encoding conversions on the templates,
  # but if the converter hasn't been loaded by Ruby beforehand (i.e. now), then it won't be
  # able to find it (due to a  bug).
  #
  # However, we don't know what conversions we may need to do a runtime. So we load up a
  # marshal-dumped structure which contains a pre-generated list of all the possible conversions,
  # and we load all of them.
  #
  # In my testing this increased the process size by about 3.9 MB (after the conversions array
  # is GC'd) and took around 170ms to run, which seems acceptable for a workaround.
  #
  # The script to dump the conversions is: https://gist.github.com/1342729

  filename    = File.join(File.dirname(__FILE__), 'data', 'encoding_conversions.dump')
  conversions = Marshal.load(File.read(filename))
  conversions.each do |from, to_array|
    to_array.each do |to|
      Encoding::Converter.new(from, to)
    end
  end
end

我似乎遇到了一些(WE)砖墙,并且不知道从哪里开始(除了可能是Linux VM)。

非常感谢任何帮助。

LJ

4 个答案:

答案 0 :(得分:0)

我有同样的问题。这是一个防火墙问题。转到开始&gt;允许prgram通过Windows防火墙。确保检查Home / work(Private)是否为“Ruby interpreter”。我很高兴去那之后!

答案 1 :(得分:0)

我使用同一本书并遇到同样的问题,我删除了Ruby 1.9.3-p0并安装了Ruby 1.9.2-p290,现在正在使用

答案 2 :(得分:0)

奇怪的家伙。关于类似问题的github上有一个讨论,但它只发生在rails版本的升级上:https://github.com/rails/rails/issues/2509

答案 3 :(得分:0)

这很可能是因为您在前一个请求中的flashsession个变量中保留了太多数据。例如,尝试仅保留id而不是对象。