cucumber-js: Windows machines > Error "You're calling functions (e.g. "When") on an instance of Cucumber that isn't running. This means you have an invalid installation"
👓 What did you see?
When I try to start a scenario on a Windows 11 machine (using the VSCode CucumberOpen.cucumber-official extension) I get the following error message:
> plano-cucumber-playwright@1.0.0 debug
> cross-env PWDEBUG=1 DEBUG=pw:api cucumber-js --name Send a marketing gift-card
`publishQuiet` option is no longer needed, you can remove it from your configuration; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md
Error:
You're calling functions (e.g. "When") on an instance of Cucumber that isn't running.
This means you have an invalid installation, mostly likely due to:
- Cucumber being installed globally
- A project structure where your support code is depending on a different instance of Cucumber
Either way, you'll need to address this in order for Cucumber to work.
See https://github.com/cucumber/cucumber-js/blob/main/docs/installation.md#invalid-installations
at checkInstall (C:\Users\admin\Desktop\Dr_Plano\scheduler.frontend.ng2\ui-tests\node_modules\@cucumber\cucumber\src\support_code_library_builder\index.ts:127:15)
at C:\Users\admin\Desktop\Dr_Plano\scheduler.frontend.ng2\ui-tests\node_modules\@cucumber\cucumber\src\support_code_library_builder\index.ts:145:11
at Object.<anonymous> (C:\Users\admin\Desktop\Dr_Plano\scheduler.frontend.ng2\ui-tests\features\app\booking-system-settings\gift-card-sale\pos-sync\boulderado.steps.ts:13:5)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module.m._compile (c:\Users\admin\Desktop\Dr_Plano\scheduler.frontend.ng2\ui-tests\node_modules\ts-node\src\index.ts:1618:23)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Object.require.extensions.<computed> [as .ts] (c:\Users\admin\Desktop\Dr_Plano\scheduler.frontend.ng2\ui-tests\node_modules\ts-node\src\index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Function.Module._load (node:internal/modules/cjs/loader:958:12)
at Module.require (node:internal/modules/cjs/loader:1141:19)
> ERROR: Command exited with status code 1.
✅ What did you expect to see?
The scenario should be started locally.
📦 Which tool/library version are you using?
The problem happens on cucumber-js 10.0.0. If I go back to version 9.6.0 the problem does not exist. Also, the problem seems to be Window specific. We have it on two Windows machines. On two other Mac machines, the problem does not exist.
🔬 How could we reproduce it?
If needed, I can provide a minimalistic project to reproduce it.
📚 Any additional context?
I tried to rule out all causes described in https://github.com/cucumber/cucumber-js/blob/main/docs/installation.md#invalid-installations. I believe none of them is the case for me.
@cucumber/cucumber is not globally installed.
Result of npm why @cucumber/cucumber is:
@cucumber/cucumber@10.0.0
node_modules/@cucumber/cucumber
@cucumber/cucumber@"10.0.0" from the root project
peer @cucumber/cucumber@">=7.0.0" from @cucumber/pretty-formatter@1.0.0
node_modules/@cucumber/pretty-formatter
@cucumber/pretty-formatter@"1.0.0" from the root project
We are using @cucumber/cucumber in our whole project, and I believe we don’t use npm link.
About this issue
- Original URL
- State: open
- Created 7 months ago
- Comments: 20 (5 by maintainers)
@davidjgoss Unfortunately internally we are restricted from cloning repo’s outside of our own instance of GitHub. But I’ll try and replicate this and run it locally and through CI. Will report back if I am successful. Thanks!
That’s a reasonable point @m4rtelli. The check on
this.cwdwas a heuristic, since we expect it to be present in a correctly-running instance of Cucumber. This makes me think there is another issue at play which this check and error is masking. I’ve made a change and released 10.3.2 so we have a status field especially for this. I don’t expect this to necessarily fix your issue, but please do give it a try and let’s see if we get a different error we can learn from.We are currently on it to analyze the reason for the error. It seems to be related to the VSCode
AbhinabaGhosh.cucumberquickextension we are using to execute the scenarios. We will follow up again soon.@davidjgoss I will provide more information. But, I think it will happen start of next year. Sorry for the delay.