/Users/project/node-modules/@cucumber/cucumber/bin/imaginaryUncacheableRequireResolveScript
at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
at Function.resolve (node:internal/modules/cjs/helpers:127:19)
at requireResolveNonCached (/Users/project/node_modules/ts-node/dist/bin.js:549:16)
at getProjectSearchDir (/Users/project/node_modules/ts-node/dist/bin.js:519:40)
at phase3 (/Users/project/node_modules/ts-node/dist/bin.js:267:27)
at bootstrap (/Users/project/node_modules/ts-node/dist/bin.js:47:30)
at main (/Users/project/node_modules/ts-node/dist/bin.js:33:12)
at Object. (/Users/project/node_modules/ts-node/dist/bin.js:579:5)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/project/node-modules/@cucumber/cucumber/bin/imaginaryUncacheableRequireResolveScript'
]
}
I am trying to run the cucumber scenario and getting a module not found error when I try to execute the cucumber scenario. I tried npm install multiple times but was not able to get rid of this error.
terminal % npm run cucumber -- features --name say-hello
Below is package.json
{
"type": "module",
"files": [
"src",
"cucumber.js"
],
"scripts": {
"cucumber": "ts-node node-modules/@cucumber/cucumber/bin/cucumber.js -p default"
},
"dependencies": {
"@cucumber/cucumber": "^9.0.1",
"chromedriver": "^115.0.1",
"cucumber": "^6.0.7",
"ts-node": "^10.9.1",
"typescript": "5.1.6"
}
}
I tried different cucumber versions and npm install multiple times and also tried clean cache.
I was expecting this error is not thrown and execution is successful but getting this error every time.
š What did you see?
cucumber ts-node node-modules/@cucumber/cucumber/bin/cucumber.js -p default features --name say-hello node:internal/modules/cjs/loader:1080 throw err; ^
Error: Cannot find module './cucumber.js' Require stack:
ā What did you expect to see?
Able to run cucumber scenario
š¦ Which tool/library version are you using?
Cucumberjs ^9.3.0 Typescript 5.1.6 Node 18
š¬ How could we reproduce it?
Steps to reproduce the behavior:
Install Cucumber
"@cucumber/cucumber": "^9.3.0", "chromedriver": "^115.0.1", "cucumber": "^6.0.7", "source-map-loader": "^4.0.1", "ts-node": "^10.9.1"
Create a file called support.ts import assert from "assert" import { When, Then } from "cucumber" import Greeter from "../src/index"
When('the greeter says hello', function () { // Write code here that turns the phrase above into concrete actions return 'pending'; });
When("the greeter says hello1", function() { console.log("hurrayy"); this.whatIHerad = new Greeter().sayHello() })
Then("I should have heard {string}", function(expectedResponse) { assert.equal(this.whatIHerad, expectedResponse) })
and also create file greeting.feature Feature: Greeting
Scenario: say-hello When the greeter says hello Then I should have heard "hello"
š Any additional context?
0
I have node 18.17.1 and npm 9.6.7 on my machine.
I am trying to run the cucumber scenario and getting a module not found error when I try to execute the cucumber scenario. I tried npm install multiple times but was not able to get rid of this error.
terminal % npm run cucumber -- features --name say-hello
Below is package.json
{ "type": "module", "files": [ "src", "cucumber.js" ], "scripts": { "cucumber": "ts-node node-modules/@cucumber/cucumber/bin/cucumber.js -p default" }, "dependencies": { "@cucumber/cucumber": "^9.0.1", "chromedriver": "^115.0.1", "cucumber": "^6.0.7", "ts-node": "^10.9.1", "typescript": "5.1.6" } } I tried different cucumber versions and npm install multiple times and also tried clean cache. I was expecting this error is not thrown and execution is successful but getting this error every time.
This text was originally generated from a template, then edited by hand. You can modify the template here.