问题描述
每当我运行黄瓜功能,我得到以下错误。
然而,脚本工作正常,但此警告消息每次我执行功能文件时出现。这里有什么问题?
C:\Automation\PickLists\Activities\2.RemoveActivity> cucumber
警告:无法加载这样的文件 - 2.1 / gherkin_lexer_en
无法加载2.1 / gherkin_lexer_en
$ LOAD_PATH是:
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。回复到Ruby lexer
捆绑安装
后,删除gherkin gem:
-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测试。
I am getting the following error whenever i run cucumber feature. However, the script works fine but this warning message appears everytime i execute the feature file. What is wrong here?
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
解决方案This workaround has worked for me. After
bundle install
, remove the gherkin gem:gem uninstall gherkin --force
Reinstall the gem (it may take a while):
gem install gherkin --platform ruby -v 2.12.2
Go to the folder of the gem inside your ruby installation directory. Something like this:
{ruby_dir}\lib\ruby\gems\2.1.0\gems\gherkin-2.12.2\lib\gherkin
And replace the
lib/gherkin/c_lexer.rb
line 7 with:prefix = ''
This workaround is specified in https://github.com/cucumber/gherkin/issues/273 with the comment by mscharley on Jan 18, 2014.
I have to follow these steps after every bundle install on Windows OS. Tested with Windows 7 and Windows 10.
这篇关于黄瓜无法加载2.1 / gherkin_lexer_en的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!