getting Cannot find module 'nightwatch/lib/runner/run'
Asked 07 September, 2021
Viewed 1.4K times
  • 60
Votes

nightwatch.conf.js

require('nightwatch-cucumber')({
cucumberArgs: ['--require', 'step_definitions', '--format', 'json:reports/cucumber.json', 'features']
})
module.exports = {
'src_folders': ['tests'],
'page_objects_path': ['pages'],

'webdriver': {
    'start_process': true,
    'server_path': require('chromedriver').path,
    'port': 9515
},

'test_settings': {
    'default': {
        'screenshots': {
            'enabled': true,
            'on_failure': true,
            'on_error': true,
            'path': 'tests_output/screenshots'
        },
        'desiredCapabilities': {
            'browserName': 'chrome',
            'chromeOptions': {
                'w3c':'false'
            }
        }
    }
}
};

This is my nightwatch.conf.js file, when I try to run my test it gives the below error

package.json

{
"name": "automation",
"version": "1.0.0",
"description": "",
"main": "nightwatch.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1",
"test:cucumber": "mkdirp report && cucumber-js --require cucumber.conf.js --require step-definitions --format node_modules/cucumber-pretty --format json:report/cucumber_report.json"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"fs": "0.0.1-security",
"handlebars": "^4.3.1",
"path": "^0.12.7",
"run": "^1.4.0",
"selenium": "^2.20.0",
"selenium-server": "^3.141.59"
},
"devDependencies": {
"chromedriver": "^77.0.0",
"cucumber": "^5.1.0",
"cucumber-html-reporter": "^5.0.2",
"cucumber-pretty": "^1.5.2",
"mkdirp": "^0.5.1",
"nightwatch": "^1.2.4",
"nightwatch-api": "^2.3.0",
"nightwatch-cucumber": "^9.1.3"
}
}

ERROR:


  

[email protected] test:cucumber C:Userssatheesh_g1DesktopAutomation

mkdirp report && cucumber-js --require cucumber.conf.js --require step-definitions --format node_modules/cucumber-pretty --format json:report/cucumber_report.json

VError: a BeforeAll hook errored, process exiting: cucumber.conf.js:15: Cannot find module 'nightwatch/lib/runner/run' at C:UsersDesktopAutomation ode_modulescucumberlib untimeindex.js:68:19 at Generator.next ()

I have checked manually in the failed path , I couldn't able to see run module. I also tried to install npm run (if it exist like that)

0 Answer