我在RVM上使用Ruby 2.0.0(在FreeBSD 9.1-i386 GENERIC上)做了一个简单的$ gem install cucumber
,当我运行$ cucumber
时出现以下错误:
uninitialized constant Cucumber::RUBY_1_8_7 (NameError)
/home/black/.rvm/gems/ruby-2.0.0-p0@cucumber/gems/cucumber-1.3.2/lib/cucumber/constantize.rb:36:in `constantize_name'
/home/black/.rvm/gems/ruby-2.0.0-p0@cucumber/gems/cucumber-1.3.2/lib/cucumber/constantize.rb:12:in `block in constantize'
/home/black/.rvm/gems/ruby-2.0.0-p0@cucumber/gems/cucumber-1.3.2/lib/cucumber/constantize.rb:11:in `each'
/home/black/.rvm/gems/ruby-2.0.0-p0@cucumber/gems/cucumber-1.3.2/lib/cucumber/constantize.rb:11:in `constantize'
/home/black/.rvm/gems/ruby-2.0.0-p0@cucumber/gems/cucumber-1.3.2/lib/cucumber/runtime/support_code.rb:73:in `load_programming_language'
/home/black/.rvm/gems/ruby-2.0.0-p0@cucumber/gems/cucumber-1.3.2/lib/cucumber/runtime/support_code.rb:194:in `programming_language_for'
/home/black/.rvm/gems/ruby-2.0.0-p0@cucumber/gems/cucumber-1.3.2/lib/cucumber/runtime/support_code.rb:178:in `load_file'
/home/black/.rvm/gems/ruby-2.0.0-p0@cucumber/gems/cucumber-1.3.2/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'
/home/black/.rvm/gems/ruby-2.0.0-p0@cucumber/gems/cucumber-1.3.2/lib/cucumber/runtime/support_code.rb:82:in `each'
/home/black/.rvm/gems/ruby-2.0.0-p0@cucumber/gems/cucumber-1.3.2/lib/cucumber/runtime/support_code.rb:82:in `load_files!'
/home/black/.rvm/gems/ruby-2.0.0-p0@cucumber/gems/cucumber-1.3.2/lib/cucumber/runtime.rb:183:in `load_step_definitions'
/home/black/.rvm/gems/ruby-2.0.0-p0@cucumber/gems/cucumber-1.3.2/lib/cucumber/runtime.rb:42:in `run!'
/home/black/.rvm/gems/ruby-2.0.0-p0@cucumber/gems/cucumber-1.3.2/lib/cucumber/cli/main.rb:47:in `execute!'
/home/black/.rvm/gems/ruby-2.0.0-p0@cucumber/gems/cucumber-1.3.2/bin/cucumber:13:in `<top (required)>'
/home/black/.rvm/gems/ruby-2.0.0-p0@cucumber/bin/cucumber:23:in `load'
/home/black/.rvm/gems/ruby-2.0.0-p0@cucumber/bin/cucumber:23:in `<main>'
/home/black/.rvm/gems/ruby-2.0.0-p0@cucumber/bin/ruby_noexec_wrapper:14:in `eval'
/home/black/.rvm/gems/ruby-2.0.0-p0@cucumber/bin/ruby_noexec_wrapper:14:in `<main>'
你有类似的问题吗?
感谢您的帮助。
PS:我的宝石列表是:
bigdecimal (1.2.0)
builder (3.2.2)
bundler (1.3.5)
cucumber (1.3.2)
diff-lcs (1.2.4)
gherkin (2.12.0)
io-console (0.4.2)
json (1.7.7)
minitest (4.3.2)
multi_json (1.7.7)
psych (2.0.0)
rake (10.0.4, 0.9.6)
rdoc (4.0.0)
rubygems-bundler (1.1.1)
rvm (1.11.3.7)
test-unit (2.0.0.0)
答案 0 :(得分:1)
在master中删除了中断的代码,请尝试:
bundle init # create a Gemfile
echo "gem 'cucumber', :git => 'https://github.com/cucumber/cucumber.git'"
bundle install
bundle exec cucumber
如果你想以这种方式使用任何额外的宝石,你需要将它们放入Gemfile
,你可以阅读更多关于它的信息,并bundler
访问它的网站:http://gembundler.com
答案 1 :(得分:0)
看起来像Cucumber
版本1.3.2
中的错误,它应该是相对修复的。
查找cucumber/constantize
:
gem which cucumber/constantize
在你的情况下它应该是:
/home/black/.rvm/gems/ruby-2.0.0-p0@cucumber/gems/cucumber-1.3.2/lib/cucumber/constantize.rb
编辑此文件并在开头添加此文本:
require 'cucumber/platform'