Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I resolve a Cucumber 'can't load such file' warning?

I'm trying to work through 'The Cucumber Book', but Cucumber is not behaving as expected.

I'm on Windows 7 (32-bit), and I'm reasonably confident I have Ruby and the necessary gems installed properly.

However, when I run cucumber I get the following message:

WARNING: cannot load such file -- 2.0/gherkin_lexer_en
Couldn't load 2.0/gherkin_lexer_en
The $LOAD_PATH was:
C:/Ruby200/lib/ruby/gems/2.0.0/gems/cucumber-1.2.1/bin/../lib
C:/Ruby200/lib/ruby/gems/2.0.0/gems/gherkin-2.11.6-x86-mingw32/lib
C:/Ruby200/lib/ruby/gems/2.0.0/gems/builder-3.2.0/lib
C:/Ruby200/lib/ruby/gems/2.0.0/gems/diff-lcs-1.2.1/lib
C:/Ruby200/lib/ruby/gems/2.0.0/gems/cucumber-1.2.1/lib

This continues for a bit, listing more paths that were checked, and then a 'Reverting to Ruby lexer', and a message 'No lexer was found for en (cannot load such file --gherkin/lexer/en)...'

Based on the path it is checking it seems like it wants a '2.0' folder in the 'gherkin-2.11.6-x86-mingw32/lib' folder, which obviously doesn't exist. There are, however, '1.8' and '1.9' folders which appear to have the 'gherkin_lexer_en' file (actually 'gherkin_lexer_en.so').

As a wild guess, I duplicated the 1.9 folder and named it 2.0. I didn't really expect that would work, but figured it was worth a shot.

How do I get cucumber to look in one of the folders I have, or alternatively get a 2.0 folder in place that it will accept?

like image 519
dglass Avatar asked Feb 27 '13 22:02

dglass


2 Answers

$ gem install gherkin --platform ruby

go to below folder inside your ruby installation directory

{rubyDir}\lib\ruby\gems\2.0.0\gems\gherkin-2.12.2\lib\gherkin

may be different path for you guys

Modify *lib/gherkin/c_lexer.rb:7 change the value of prefix as below:

prefix = ''

Found answer at below link https://github.com/cucumber/gherkin/issues/273

with reply mscharley commented on Jan 18, 2014

worked for me like charm..

like image 57
maruti060385 Avatar answered Oct 16 '22 16:10

maruti060385


On Windows, you will have to use Ruby 1.9 for the time being. There isn't a Ruby 2.0 build of gherkin published yet.

like image 45
joshuanapoli Avatar answered Oct 16 '22 15:10

joshuanapoli