bug: ESM_UNSUPPORTED_ESM_URL_SCHEME for `-t browser` in windows
SgtPooki opened this issue · 5 comments
Describe the bug
Error importing from ESM package via playwright when running on windows. Note that I modified node_modules/playwright-test/cli.js:111:15
locally so that we could get the filepath:
filepath C:\Users\sgtpo\code\work\protocol.ai\ipfs\js-kubo-rpc-client\node_modules\aegir\src\config\pw-test.js
node --version
v18.12.1
To Reproduce
Steps to reproduce the behavior:
- on windows
- Go to commit
65d42f18595dc938c81ab516ba41dc3b5133c560
on https://github.com/ipfs/js-kubo-rpc-client - run
npm install
- run
npm install aegir@latest
(also occuring on old version, but attempted to use latest to check bug) - run
npm run test -- -t browser
- See error:
filepath C:\Users\sgtpo\code\work\protocol.ai\ipfs\js-kubo-rpc-client\node_modules\aegir\src\config\pw-test.js
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
at new NodeError (node:internal/errors:393:5)
at throwIfUnsupportedURLScheme (node:internal/modules/esm/resolve:1026:11)
at defaultResolve (node:internal/modules/esm/resolve:1106:3)
at nextResolve (node:internal/modules/esm/loader:163:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:841:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
at ESMLoader.import (node:internal/modules/esm/loader:525:22)
at importModuleDynamically (node:internal/modules/esm/translators:110:35)
at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14)
at loadEsm (file:///C:/Users/sgtpo/code/work/protocol.ai/ipfs/js-kubo-rpc-client/node_modules/playwright-test/cli.js:111:15) {
code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}
Expected behavior
No ESM import errors
Desktop (please complete the following information):
- OS: Microsoft Windows 11 Pro
- Version 10.0.22000 Build 22000
- Browser:
-t browser
- Version 10.0.22000 Build 22000
- System Model Surface Book 2
- System Type x64-based PC
- Processor Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz, 2112 Mhz, 4 Core(s), 8 Logical Processor(s)
Additional context
Supposedly fixed in playwright by microsoft/playwright#12307
Also getting this on the LTS version of node (v18.16.1 (64-bit))
Is this still a problem? If it's fixed by a PR to playwright it might need an update to https://github.com/hugomrdias/playwright-test - if that goes out as a patch release or a minor there'd be nothing to do here, correct?
I can try to repro
Oops, seems like we needed more information for this issue, please comment with more details or this issue will be closed in 7 days.
I was unable to reproduce this error