黄瓜无法加载2.1 / gherkin_lexer_en

时间:2015-01-26 18:50:35

标签: cucumber watir

每当我运行黄瓜功能时,我都会收到以下错误。 但是,脚本工作正常但每次执行功能文件时都会显示此警告消息。这有什么不对?

C:\Automation\PickLists\Activities\2.RemoveActivity>cucumber
WARNING: cannot load such file -- 2.1/gherkin_lexer_en
Couldn't load 2.1/gherkin_lexer_en
The $LOAD_PATH was:
lib
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/cucumber-1.3.18/bin/../lib
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/builder-3.2.2/lib
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/diff-lcs-1.2.5/lib
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/multi_json-1.10.1/lib
C:/Ruby21-x64/lib/ruby/gems/2.1.0/extensions/x64-mingw32/2.1.0/gherkin-2.12.2
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/gherkin-2.12.2/lib
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/multi_test-0.1.1/lib
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/cucumber-1.3.18/lib
C:/Ruby21-x64/lib/ruby/gems/2.1.0/extensions/x64-mingw32/2.1.0/json-1.8.2
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/json-1.8.2/lib
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rubyzip-1.1.6/lib
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/ffi-1.9.6-x64-mingw32/lib
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/childprocess-0.5.5/lib
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/websocket-1.2.1/lib
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.44.0/lib
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.6.11/lib
C:/Ruby21-x64/lib/ruby/site_ruby/2.1.0
C:/Ruby21-x64/lib/ruby/site_ruby/2.1.0/x64-msvcrt
C:/Ruby21-x64/lib/ruby/site_ruby
C:/Ruby21-x64/lib/ruby/vendor_ruby/2.1.0
C:/Ruby21-x64/lib/ruby/vendor_ruby/2.1.0/x64-msvcrt
C:/Ruby21-x64/lib/ruby/vendor_ruby
C:/Ruby21-x64/lib/ruby/2.1.0
C:/Ruby21-x64/lib/ruby/2.1.0/x64-mingw32
C:/Automation/PickLists/Activities/2.RemoveActivity/lib. Reverting to Ruby lexer

2 个答案:

答案 0 :(得分:5)

这种解决方法对我有用。在bundle install之后,删除小黄瓜宝石:

gem uninstall gherkin --force

重新安装gem(可能需要一段时间):

gem install gherkin --platform ruby -v 2.12.2

转到ruby安装目录中的gem文件夹。像这样:

{ruby_dir}\lib\ruby\gems\2.1.0\gems\gherkin-2.12.2\lib\gherkin

并将lib/gherkin/c_lexer.rb第7行替换为:

prefix = ''

此解决方法在https://github.com/cucumber/gherkin/issues/273中指定,并附有mscharley于2014年1月18日发表的评论。

在Windows操作系统上安装每个软件包之后,我必须遵循这些步骤。使用Windows 7和Windows 10进行测试。

答案 1 :(得分:2)

这是一个已知的黄瓜虫,当你使用红宝石64位时。见这里:https://github.com/cucumber/gherkin/issues/273