简体   繁体   English

使用memcached运行服务器Rails 2.3.5时出错

[英]Error when run server rails 2.3.5 with memcached

I use ruby version 1.8.7, gem version 1.3.5, rails version 2.3.5 and memcache. 我使用ruby版本1.8.7,gem版本1.3.5,rails版本2.3.5和memcache。 I get this error when I run server 运行服务器时出现此错误

phuongnm-lap:~/trunk/hurricane$ ruby script/server
=> Booting Mongrel
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
/home/asiantech/.rvm/gems/ruby-1.8.7-p374/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `require': /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/get_process_mem-0.2.0/lib/get_process_mem.rb:60: undefined (?...) sequence: /(?<value>(\d*\.{0,1}\d+))\s+(?<unit>\w\w)/ (SyntaxError)
    from /home/asiantech/.rvm/gems/ruby-1.8.7-p374/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `require'
    from /home/asiantech/.rvm/gems/ruby-1.8.7-p374/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
    from /home/asiantech/.rvm/gems/ruby-1.8.7-p374/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `require'
    from /home/asiantech/.rvm/gems/ruby-1.8.7-p374/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
    from /home/asiantech/.rvm/gems/ruby-1.8.7-p374/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
    from /home/asiantech/.rvm/gems/ruby-1.8.7-p374/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
    from ./script/../config/boot.rb:41:in `load_gems'
    from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:164:in `process'
    from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send'
    from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
    from /home/asiantech/trunk/hurricane/config/environment.rb:34
    from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
    from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
    from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
    from /home/asiantech/trunk/hurricane/vendor/bundle/ruby/1.8/gems/rails-2.3.5/lib/commands/server.rb:84
    from script/server:3:in `require'
    from script/server:3

please help me! 请帮我!

Your ruby version is too old for the get_process_mem gem to run . 您的红宝石版本太旧,无法运行get_process_mem gem The gem uses a complex regular expression to parse information from /proc files on your linux server. gem使用复杂的正则表达式来解析Linux服务器上/proc文件中的信息。 However, ruby 1.8.7 does not support such complex regexp yet. 但是,ruby 1.8.7尚不支持这种复杂的正则表达式。

You can see for yourself in irb. 您可以在irb中看到自己。 In ruby 1.8.7 the match fails: 在ruby 1.8.7中,匹配失败:

"aaa" =~ /(?<value>(\d*\.{0,1}\d+))\s+(?<unit>\w\w)/
# => SyntaxError: compile error
# => (irb):1: undefined (?...) sequence: /(?<value>(\d*\.{0,1}\d+))\s+(?<unit>\w\w)/

whereas under ruby 2.2 it works ok (does not return anything in this test case, but more importantly, does not fail with error): 而在ruby 2.2下可以正常工作(在此测试用例中不返回任何内容,但更重要的是,不会因错误而失败):

"aaa" =~ /(?<value>(\d*\.{0,1}\d+))\s+(?<unit>\w\w)/
# => nil

You have a few options now: 您现在有几种选择:

  • Upgrade to a newer ruby (and rails) if you can, you won't have to solve these elderly code-related problems and won't be using an unsupported ruby/rails version any more, but nevertheless this is rather a cumbersome process. 如果可以的话,升级到新的ruby(和rails),就不必解决这些与旧代码相关的问题,也不再使用不受支持的ruby / rails版本,但是,这是一个繁琐的过程。
  • Get rid of the get_process_mem gem. 摆脱get_process_mem gem。 You can see the same info, ie the memory consumed by the process, using command line utilities, without needing to install any gem. 您可以使用命令行实用程序查看相同的信息,即进程消耗的内存,而无需安装任何gem。 Try the top or htop commands for example. 例如,尝试使用tophtop命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM