error with esm on windows
See original GitHub issueI was following @mcollina tutorial for Fastify, and I faced with an error related to fastify-autoload plugin:
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader
at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:781:11)
at Loader.resolve (internal/modules/esm/loader.js:85:40)
at Loader.getModuleJob (internal/modules/esm/loader.js:229:28)
at Loader.import (internal/modules/esm/loader.js:164:28)
at importModuleDynamically (internal/modules/cjs/loader.js:1199:27)
at exports.importModuleDynamicallyCallback (internal/process/esm_loader.js:30:14)
at loadPlugin (C:\Users\amis\Desktop\fastify3-test\node_modules\fastify-autoload\index.js:117:5)
at C:\Users\amis\Desktop\fastify3-test\node_modules\fastify-autoload\index.js:27:12
at Array.map (<anonymous>)
at fastifyAutoload (C:\Users\amis\Desktop\fastify3-test\node_modules\fastify-autoload\index.js:26:29) {
code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}
I’m running Node v14.7.0 on Windows 10. This is how the app looks like:
app.js
import fastify from 'fastify'
import autoload from 'fastify-autoload'
import { join } from 'desm'
export default function (opts) {
const app = fastify(opts)
app.register(autoload, {
dir: join(import.meta.url, 'routes')
})
return app
}
/routes/hello.js
export default async function (app) {
app.get('/', async function (req, rep) {
return { hello: 'world' }
})
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:25 (25 by maintainers)
Top Results From Across the Web
ES Module loading with abolute path fails on windows #31710
Version: v13.8.0; Platform: Windows 10 64-bit version 1809; Subsystem: "esm" maybe? What steps will reproduce the bug?
Read more >Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file ...
ERROR Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths ...
Read more >Tools and tips used for troubleshooting ESM status problems
In this post, we will cover general troubleshooting of ESM "status" ... If you get an error here, your WMI service is not...
Read more >Lab 7.1 ERR_UNSUPPORTED_ESM_URL_SCHEME
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be ...
Read more >112E ESM Module number ("name") returned error code value ...
The ESM Module name (at position number in the stack, if multiple modules are configured) returned error code value from an Xauth (authorize...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@StarpTech can you open an issue on node core on this and tag me on it? Thanks. This is very confusing.
Because in Linux a path is a valid file URL? 🤔