Have you read the Contributing Guidelines on issues?
WebdriverIO Version
latest ("@wdio/cli": "^8.24.13")
Node.js Version
18.19.0
Mode
WDIO Testrunner
Which capabilities are you using?
No response
What happened?
This is a follow-up of issue #10901. I started with WDIO installation following these steps
- Created a git repo, cloned it on my system and did
npm init
- Proceeded with
npm init wdio and accepted the default behavior in most cases (using typescript)
- Ran
npm run wdio and faced error (see log output)
The same is working when running either on node 18.18.2 or 20.10.0. The same error occured before on node 20 but was resolved with PR #11202. However, node 18.19.0 is now also using npm 10.2.3 and the if statement added with PR #11202 only checks on nodeMajorVersion() >= 20 to set additional node options. Thus I assume that the root cause is npm 10.
What is your expected behavior?
Running the generated wdio project on node 18.19.0 shall work without issues as it does on node 18.18.2 and 20.10.0
How to reproduce the bug.
Relevant log output
C:\Users\...\git\wdio-sample>npm run wdio
> wdio-sample@1.0.0 wdio
> wdio run ./wdio.conf.ts
2023-12-07T09:37:05.512Z ERROR @wdio/config:ConfigParser: Failed loading configuration file: file:///C:/Users/.../git/wdio-sample/wdio.conf.ts: Cannot use import statement outside a module
C:\Users\...\git\wdio-sample\wdio.conf.ts:1
import type { Options } from '@wdio/types'
^^^^^^
SyntaxError: Cannot use import statement outside a module
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1274:20)
at Module._compile (node:internal/modules/cjs/loader:1320:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
at Module.load (node:internal/modules/cjs/loader:1197:32)
at Module._load (node:internal/modules/cjs/loader:1013:12)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:202:29)
at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:336:24)
at async ConfigParser.addConfigFile (file:///C:/Users/.../git/wdio-sample/node_modules/@wdio/config/build/node/ConfigParser.js:86:36)
at async ConfigParser.initialize (file:///C:/Users/.../git/wdio-sample/node_modules/@wdio/config/build/node/ConfigParser.js:48:13)
at async Launcher.run (file:///C:/Users/.../git/wdio-sample/node_modules/@wdio/cli/build/launcher.js:41:9)
Code of Conduct
Is there an existing issue for this?
Have you read the Contributing Guidelines on issues?
WebdriverIO Version
latest ("@wdio/cli": "^8.24.13")
Node.js Version
18.19.0
Mode
WDIO Testrunner
Which capabilities are you using?
No response
What happened?
This is a follow-up of issue #10901. I started with WDIO installation following these steps
npm initnpm init wdioand accepted the default behavior in most cases (using typescript)npm run wdioand faced error (see log output)The same is working when running either on node 18.18.2 or 20.10.0. The same error occured before on node 20 but was resolved with PR #11202. However, node 18.19.0 is now also using npm 10.2.3 and the if statement added with PR #11202 only checks on
nodeMajorVersion() >= 20to set additional node options. Thus I assume that the root cause is npm 10.What is your expected behavior?
Running the generated wdio project on node 18.19.0 shall work without issues as it does on node 18.18.2 and 20.10.0
How to reproduce the bug.
npm installnpm run wdiowith node 18.19.0Relevant log output
Code of Conduct
Is there an existing issue for this?