Question

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?

Était-ce utile?

La solution 2

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.

Autres conseils

$ 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..

If you are using gherkin ver 2.12.1, you should be able to use cucumber with ruby 2.0 on Windows now.

 

First, install gherkin-2.12.1 with --ignore-dependencies option.

The reson --ignore-dependencies option is required is that without specifying it, it will install json 1.4.X which is very old version and fail to install on ruby 2.0.

 

At this point, you should be able to ruby cucumber on ruby 2.0, but you'll see the error message like above as warning message. This means you can still use cucumber although you are seeing the message.

 

If you want to remove the error, follow the step below.

 

  1. create [2.0] folder on [ruby installed dir]\lib\ruby\gems\2.0.0\gems\gherkin-2.12.1\lib (This folder includes gherkin_lexer_XX.so).

  2. copy all the contents in [ruby installed dir]\lib\ruby\gems\2.0.0\gems\gherkin-2.12.1\lib to the created [2.0] folder (you don't need to copy [2.0] folder you created).

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top