Skip to content

Failed launching test session: Error: Couldn’t initialise “@wdio/cucumber-framework”

I am setting up the wdio using command “npm init wdio” and try to run the test files. it is giving below error

Failed launching test session: Error: Couldn't initialise "@wdio/cucumber-framework". [0-0] Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/formatter/helpers/event_data_collector' is not defined by

Below is my package.json file

"name": "wdio-new",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
    "test": "echo "Error: no test specified" && exit 1",
    "wdio": "wdio run wdio.conf.js"
},
"author": "",
"license": "ISC",
"devDependencies": {
    "@wdio/cli": "^7.16.12",
    "@wdio/cucumber-framework": "^7.16.12",
    "@wdio/local-runner": "^7.16.12",
    "@wdio/spec-reporter": "^7.16.11",
    "chromedriver": "^96.0.0",
    "wdio-chromedriver-service": "^7.2.2"
}

}

Answer

I managed to fix this issue by reinstalling node and checking the option to “Automatically install the necessary tools” during setup