我有一个小的Rails 4.0.0 / Ruby 2.0.0-p247应用程序,我想写一些测试。我跑的时候
rake cucumber:all
我收到以下错误:
/Users/me/.rvm/rubies/ruby-2.0.0-p247/bin/ruby -S bundle exec cucumber --profile default
/Users/me/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/json/common.rb:155:in `parse': uninitialized constant JSON::Parser (NameError)
from /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/multi_json-1.7.8/lib/multi_json/adapters/json_common.rb:16:in `load'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/multi_json-1.7.8/lib/multi_json/adapter.rb:19:in `load'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/multi_json-1.7.8/lib/multi_json.rb:118:in `load'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/gherkin-2.12.0/lib/gherkin/i18n.rb:14:in `<class:I18n>'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/gherkin-2.12.0/lib/gherkin/i18n.rb:6:in `<module:Gherkin>'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/gherkin-2.12.0/lib/gherkin/i18n.rb:5:in `<top (required)>'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/gherkin-2.12.0/lib/gherkin/lexer/i18n_lexer.rb:2:in `require'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/gherkin-2.12.0/lib/gherkin/lexer/i18n_lexer.rb:2:in `<top (required)>'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/gherkin-2.12.0/lib/gherkin.rb:1:in `require'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/gherkin-2.12.0/lib/gherkin.rb:1:in `<top (required)>'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/cucumber-1.3.5/lib/cucumber/cli/main.rb:2:in `require'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/cucumber-1.3.5/lib/cucumber/cli/main.rb:2:in `<top (required)>'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/cucumber-1.3.5/bin/cucumber:11:in `require'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/cucumber-1.3.5/bin/cucumber:11:in `<top (required)>'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/bin/cucumber:23:in `load'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/bin/cucumber:23:in `<main>'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `eval'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `<main>'
我运行捆绑安装,捆绑更新,宝石清理等无济于事。这个相同的Rails应用程序在另一台机器(Mac OS X 10.8.4)上运行良好,但我的(Mac OS X 10.8.2)不起作用。有什么想法吗?
答案 0 :(得分:4)
我有完全相同的错误。原因在于:
https://github.com/intridea/multi_json/issues/131
由于他们有错误修复,所以您需要做的就是将multi_json更新为1.7.9
- 已编辑请不要更改Gemfile.lock,检查注释以获取详细信息
答案 1 :(得分:0)
我认为问题的根源不是来自JSON :: Parser。 'ruby_noexec_wrapper'错误可能表明存在RVM问题。
尝试
which cucumber
它应该别名为bundled_cucumber
还尝试更新RVM
rvm get stable
和/或制作新的宝石
rvm gemset empty