cucumber 无法加载 2.1/gherkin_lexer_en

标签 cucumber watir

每当我运行 cucumber 功能时,我都会收到以下错误。 但是,该脚本工作正常,但每次执行功能文件时都会出现此警告消息。这里出了什么问题?

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

最佳答案

这个解决方法对我有用。 捆绑安装后,删除 gherkin gem:

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 操作系统上安装每个 bundle 后,我都必须执行以下步骤。在 Windows 7 和 Windows 10 上进行了测试。

关于 cucumber 无法加载 2.1/gherkin_lexer_en,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28156702/

相关文章:

watir - 如何更改闪光颜色?

ruby - 使用 Watir 时为 "NameError: uninitialized constant UserAgent"

ruby - Grails上的Cuke4Duke

ruby-on-rails - 获取 “Gem::LoadError: can' t 激活 jwt (~> 0.1.4),已经激活 jwt-1.0.0。”

java - 如何检查 PageObject 的所有元素是否有效(Java、Serenity、Cucumber)

TypeScript 模块解析不适用于 Cucumber-js

Ruby Watir - 获取 NoMethodError : undefined method 'start' on a newly installed PC

ruby - 在鞋中使用 Watir( ruby )

ruby - 需要有关 Rspec 示例的帮助

java - 将 jvm 参数传递给 Gradle 测试任务