Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cucumber Couldn't load 2.1/gherkin_lexer_en

Tags:

cucumber

watir

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
like image 757
RayM Avatar asked Feb 12 '23 02:02

RayM


1 Answers

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.

like image 86
evedovelli Avatar answered May 01 '23 06:05

evedovelli