Protractor 找不到用于量角器测试的Cumber插件

Protractor 找不到用于量角器测试的Cumber插件,protractor,cucumber,Protractor,Cucumber,我是量角器的新手,按照量角器网站上的说明进行了设置。当我尝试使用cucumber框架运行量角器测试时,我总是得到“Error:Error:notfind module'cucumber'”。有什么帮助吗?下面是按配置列出的 cucumber-conf.js exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub', capabilities: { browserName:'chrome' },

我是量角器的新手,按照量角器网站上的说明进行了设置。当我尝试使用cucumber框架运行量角器测试时,我总是得到“Error:Error:notfind module'cucumber'”。有什么帮助吗?下面是按配置列出的

cucumber-conf.js

exports.config = {
  seleniumAddress: 'http://localhost:4444/wd/hub',
  capabilities: {
      browserName:'chrome'
  },
  framework: 'custom',
  frameworkPath: require.resolve('protractor-cucumber-framework'),
  specs: [
    './cucumber/*.feature'
  ],
  cucumberOpts: {
    require: ['./cucumber/*.js'],
    tags: [],                      
    strict: true,                  
    format: ["pretty"],            
    dryRun: false,                 
    compiler: []                   
  },
  onPrepare: function () {
    browser.manage().window().maximize();
  }
};
当我运行
量角器cucumber-conf.js
时,我得到以下错误

/opt/protractor_tests
➔ protractor cucumber-conf.js
(node:5681) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[12:06:55] I/launcher - Running 1 instances of WebDriver
[12:06:55] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[12:06:57] E/launcher - Error: Error: Cannot find module 'cucumber'
    at Function.Module._resolveFilename (module.js:472:15)
    at Function.Module._load (module.js:420:25)
    at Module.require (module.js:500:17)
    at require (internal/module.js:20:19)
    at Object.module.exports.load (/opt/protractor_tests/node_modules/protractor-cucumber-framework/lib/cucumberLoader.js:5:12)
    at Object.<anonymous> (/opt/protractor_tests/node_modules/protractor-cucumber-framework/index.js:5:48)
    at Module._compile (module.js:573:32)
    at Object.Module._extensions..js (module.js:582:10)
    at Module.load (module.js:490:32)
    at tryModuleLoad (module.js:449:12)
[12:06:57] E/launcher - Process exited with error code 100
/opt/量角器测试
➔ 量角器cumber-conf.js
(节点:5681)弃用警告:os.tmpDir()已弃用。请改用os.tmpdir()。
[12:06:55]I/launcher-运行WebDriver的1个实例
[12:06:55]I/hosted-使用位于的selenium服务器http://localhost:4444/wd/hub
[12:06:57]E/launcher-错误:错误:找不到模块“cucumber”
在Function.Module.\u解析文件名(Module.js:472:15)
在Function.Module.\u加载(Module.js:420:25)
at Module.require(Module.js:500:17)
根据需要(内部/module.js:20:19)
在Object.module.exports.load(/opt/dragrator_tests/node_modules/dragrator cumber framework/lib/cucumberLoader.js:5:12)
反对。(/opt/dragrator_tests/node_modules/dragrator cumber framework/index.js:5:48)
在模块处编译(Module.js:573:32)
在Object.Module.\u extensions..js(Module.js:582:10)
在Module.load(Module.js:490:32)
在tryModuleLoad时(module.js:449:12)
[12:06:57]E/启动器-进程退出,错误代码为100

您是否安装了cucumber模块?。如果没有,请将其添加到您的package.json
npm安装-g cucumber-S
我试过了。仍然面临着同样的错误。请提供更多帮助。按照本博客中的步骤操作。在问题中添加您的package.json