Search code examples
protractorcucumbercucumberjs

Error: Cannot find module 'protractor-multiple-cucumber-html-reporter-plugin'


I'm writing e2e tests using Protractor integrated with Cucumber. I wanted to be able to generate HTML reports for my tests so I decided to use the following plugin:

https://www.npmjs.com/package/protractor-multiple-cucumber-html-reporter-plugin

I've installed it as per description, also added necessary options to my protractor conf.js file:

plugins: [{
    package: 'protractor-multiple-cucumber-html-reporter-plugin',
    options:{
        automaticallyGenerateReport: true,
        removeExistingJsonReportFile: true
    }
}]

However, when I run my tests, I get this Error: Cannot find module 'protractor-multiple-cucumber-html-reporter-plugin' I've double checked and protractor-multiple-cucumber-html-reporter-plugin is present in my node-modules folder. When I comment out the above code, the test passes without errors.

My Protractor version is 5.3.2, protractor-cucumber-framework version: 5.0.0 and protractor-multiple-cucumber-html-reporter-plugin version is 1.7.0

Edit: Here's my full config file:

exports.config = {
directConnect: true,
capabilities: {
    'browserName': 'chrome',
    'chromeOptions': {
    }
},
specs: [
    'features/**/home.feature'
],
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
cucumberOpts: {
    require: ['specs/test_spec.js'],
    format: 'json:results.json',
},
onPrepare: function() {
    browser.ignoreSynchronisation = true;
    browser.manage().timeouts().implicitlyWait(30000);
    browser.manage().window().maximize();
},
params: {
    username: 'Admin',
    password: 'Password',
},
plugins: [{
package: 'protractor-multiple-cucumber-html-reporter-plugin',
    options:{
    automaticallyGenerateReport: true,
    removeExistingJsonReportFile: true,
    }
}],
getPageTimeout: 30000,

}


Solution

  • I had the same issue. Either you must initialize your package.json or change this to your config, at the plugins section:

    package: require.resolve('protractor-multiple-cucumber-html-reporter-plugin');