我收到错误:执行量角器时找不到模块“黄瓜” [英] I receive the error: cannot find module 'cucumber' when executing Protractor
问题描述
我找到了一些帖子,描述了设置步骤,但是按照这些步骤我会收到一个错误消息:找不到模块黄瓜。我在全局安装了黄瓜,量角器和量角器黄瓜,并且可以单独执行它们,但在尝试使用黄瓜框架执行量角器时却不能单独执行它们。如下:
var env = require('./ environment.js');
//确保黄瓜框架正常工作的小型套件。
exports.config = {
seleniumAddress:env.seleniumAddress,
框架:'cucumber',
//规范模式相对于此目录。
规格:[
'../app/modules/auth/html/cucumber/*.feature'
],
功能:env.capabilities,
baseUrl:env.baseUrl,
黄瓜选择:{
require:'../app/modules/auth/html/cucumber/stepDefinitions.js',
标签:'@dev',
格式:'summary'
}
};
有什么建议可以解决这个问题吗?
堆栈跟踪:
在 http:// localhost:4444 / wd使用硒服务器/ hub
[launcher]运行1个WebDriver
[launcher]实例错误:错误:在Function.Module._resolveFilename(module.js:上找不到模块'cucumber'
338:15)Function.Module._load(module.js:280:25)
在Module.require(module.js:364:17)
在require(module.js :380:17)Object.exports.run(/Users/lbrown/node_modules/protractor/lib/frameworks/cucumber.js:13:18)中的
/ Users / lbrown / node_modules / protractor中的
/lib/runner.js:293:35
在_fulfilled(/Users/lbrown/node_modules/protractor/node_modules/q/q.js:797:54)
在self.promiseDispatch.done(/用户/ lbrown / node_modules /量角器/node_modules/q/q.js:826:30)
在Promise.promise.promiseDispatch(/ Users / l brown / node_modules / protractor / node_modules / q / q.js:759:13)
在/Users/lbrown/node_modules/protractor/node_modules/q/q.js:573:44
[启动器]进程退出,错误代码为100
仍然有可能未在全球范围内安装Cucumber。
在命令行上尝试以下操作:
node
> require('cucumber')
如果抱怨没有找到黄瓜,那么您没有安装全球黄瓜。否则,可以粘贴堆栈跟踪吗?
I have found some posts describing the steps for setting this up but when I follow them I receive an error: cannot find module 'cucumber'. I have cucumber and protractor and protractor-cucumber installed global and can execute them individually but not when trying to execute Protractor with a framework of cucumber.
The config file I am using is as follows:
var env = require('./environment.js');
// A small suite to make sure the cucumber framework works.
exports.config = {
seleniumAddress: env.seleniumAddress,
framework: 'cucumber',
// Spec patterns are relative to this directory.
specs: [
'../app/modules/auth/html/cucumber/*.feature'
],
capabilities: env.capabilities,
baseUrl: env.baseUrl,
cucumberOpts: {
require: '../app/modules/auth/html/cucumber/stepDefinitions.js',
tags: '@dev',
format: 'summary'
}
};
Any suggestions what I can try in order to resolve the issue?
stacktrace: Using the selenium server at http://localhost:4444/wd/hub [launcher] Running 1 instances of WebDriver [launcher] Error: Error: Cannot find module 'cucumber' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:364:17) at require (module.js:380:17) at Object.exports.run (/Users/lbrown/node_modules/protractor/lib/frameworks/cucumber.js:13:18) at /Users/lbrown/node_modules/protractor/lib/runner.js:293:35 at _fulfilled (/Users/lbrown/node_modules/protractor/node_modules/q/q.js:797:54) at self.promiseDispatch.done (/Users/lbrown/node_modules/protractor/node_modules/q/q.js:826:30) at Promise.promise.promiseDispatch (/Users/lbrown/node_modules/protractor/node_modules/q/q.js:759:13) at /Users/lbrown/node_modules/protractor/node_modules/q/q.js:573:44 [launcher] Process exited with error code 100
It's still likely that cucumber isn't installed globally.
Try this on your command line:
node
> require('cucumber')
If that complains about cucumber not being found, then you didn't install cucumber globally. Otherwise, can you paste the stacktrace.
这篇关于我收到错误:执行量角器时找不到模块“黄瓜”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!