我正在尝试将我的项目从 mri
迁移到 rubinius
以获得并发优势。
我启动了服务器并打开第一页,然后出现错误:
Puma caught this error: undefined method `=~' for Pathname (NameError)
kernel/common/module.rb:212:in `instance_method'
kernel/common/module.rb:354:in `undef_method'
kernel/bootstrap/array.rb:66:in `each'
kernel/common/module.rb:352:in `undef_method'
...
我的 gem 文件
source 'https://rubygems.org'
ruby '2.1.0', :engine => "rbx", engine_version: '2.2.1'
gem "rubysl" # Ruby Standard Library meta-gem for rubinius
# Server requirements
gem 'puma'
...
这里可能存在什么问题?
最佳答案
我检查了你的堆栈跟踪并查看了 Rubinius 源代码。有问题的行是:
class Pathname
undef =~ # THIS IS IT
end
#=~
是 Object
上的实例方法,因此通常 undef =~
应该适用于任何类...除非它已经在对象
或路径名
上undef
。
我想知道发生这种情况是否是因为您的 Gemfile 中有 rubysl
gem。我不认识Rubinius,但从我看来,它似乎不需要你特别包括这个 gem 。或者也许在过去的版本中是这样,但现在不是。如果标准库被加载两次,那就可以解释为什么 undef =~
第二次失败。
如果这没有帮助,我建议您尝试暂时删除尽可能多的 gem ,看看问题是否消失。如果是这样,请将它们一一添加回去,直到找到导致问题的原因。
关于ruby - 迁移到鲁比尼乌斯,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20248350/