-
Notifications
You must be signed in to change notification settings - Fork 22
Closed
Description
Hello,
using this on Windows right now produces an error like this:
file://[absolut Path to Project]/output/Effect.Aff/foreign.js:530
throw util.fromLeft(step);
^
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol '[drive letter]:'
at new NodeError (node:internal/errors:371:5)
at defaultResolve (node:internal/modules/esm/resolve:1016:11)
at ESMLoader.resolve (node:internal/modules/esm/loader:422:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:222:40)
at ESMLoader.import (node:internal/modules/esm/loader:276:22)
at importModuleDynamically (node:internal/modules/esm/translators:111:35)
at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14)
at file://[absolulte path to project]/output/Test.Spec.Discovery/foreign.js:24:27
at Array.map (<anonymous>)
at getMatchingModules (file://[absolute path to project]/output/Test.Spec.Discovery/foreign.js:20:6) {
code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}
for me the fix was quite easy - in the foreign.jsfor Test.Spac.Discovery is just changed getMatchingModules to this:
function getMatchingModules (pattern) {
var directories = fs.readdirSync(path.join(__dirname, '..'))
const modulePromises = directories
.filter(function (directory) {
return new RegExp(pattern).test(directory)
})
.map(function (name) {
const fullPath = path.join('file://', __dirname, '..', name, 'index.js')
var modulePromise = import(fullPath)
return modulePromise.then(module => {
return module && typeof module.spec !== 'undefined' ? module.spec : null
})
})
const modules = Promise.all(modulePromises)
return modules.then(ms =>
ms.filter(function (x) {
return x
})
)
}in case you don't see it - it's just these lines
const fullPath = path.join('file://', __dirname, '..', name, 'index.js')
var modulePromise = import(fullPath)basically adding file:// to the path as the error indicated.
of course this is probably not a good fix for other OSs but maybe it helps you get started.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels