当前位置: 首页 > 知识库问答 >
问题:

cucumber无法加载2.1/gherkin_lexer_en

闻人花蜂
2023-03-14

每当我运行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

共有2个答案

家经纶
2023-03-14

当您使用ruby 64bit时,这是cucumber的一个已知错误。请参阅此处:https://github.com/cucumber/gherkin/issues/273

章锦
2023-03-14

这种变通办法对我很有效。在< code>bundle install之后,删除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

并将< code > lib/gherkin/c _ lexer . Rb 第7行替换为:

prefix = ''

此解决方法在 mscharley 于 2014 年 1 月 18 日的评论中 https://github.com/cucumber/gherkin/issues/273 中指定。

在Windows操作系统上安装每个软件包后,我都必须遵循这些步骤。使用Windows 7和Windows 10进行测试。

 类似资料:
  • 我正在尝试在文本文件中运行一个基本的cucumber功能:calculator/features/adding.feature.txt: 当在../calculator/ directory并运行< code>cucumber,我得到的输出是:0场景0步骤0m0.000s 当我运行时,我得到了输出: 无法加载文件features/adding.feature.txt的“txt”编程语言:无法加载此

  • 我是cucumber可扩展代码的新手,我需要帮助。我正在使用java 8和maven,并希望生成cucumber可扩展报告。但每次我得到以下错误: Pom.xml文件是: Runner类代码: 我得到这个错误:

  • 我正在https://www.tutorialspoint.com/cucumber/cucumber_annotations.htm上做这个cucumber教程 他们告诉我在pom文件中添加一些依赖项:selenium-java、cucumber-java、cucumber-junit和jUnit。这是我的pom: 然后他们让我创建一个特性文件:annotation.feature和一个步骤定义

  • 我试图升级cucumber以使用并行执行功能,结果导致报表门户出现问题。 在相容性矩阵中,它说: cucumberjava和cucumberjUnit的版本- 4.0.0 - 4.2.6cucumber代理4.0.0的测试版本 我尝试了不同版本的Cucumber4.0。0, 4.2.3, 4.2.2, 4.2.6号cucumber制剂4.0。上面说 cucumber.runtime.Cucumbe

  • 如关联指南中简要提到的,预先加载是一次查询多个模型(一个"主"模型和一个或多个关联模型)的数据的行为. 在 SQL 级别上,这是具有一个或多个 join) 的查询. 完成此操作后,Sequelize 将在返回的对象中将适当关联的模型添加到适当命名的自动创建的字段中. 在 Sequelize 中,主要通过在模型查找器查询中使用 include 参数(例如,findOne, findAll 等)来完成

  • 这是密码。没有警告,文件正常。