You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running node-dev ./index.mjs on Windows, Node.js (14.* and 16.*) will throw ERR_UNSUPPORTED_ESM_URL_SCHEME. It works on Ubuntu.
According to doc, I renamed to .mjs and I believe this is the only change needed for ESM.
When using ESModule syntax and .mjs files, node-dev will automatically use a loader to know which files to watch.
Repro steps
I created a repo for bug repro, with GitHub Actions configured to run on both Ubuntu and Windows.
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 'd:'
at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:791:11)
at Loader.resolve (internal/modules/esm/loader.js:89:40)
at Loader.getModuleJob (internal/modules/esm/loader.js:242:28)
at Loader.import (internal/modules/esm/loader.js:177:28)
at internal/process/esm_loader.js:57:31
at initializeLoader (internal/process/esm_loader.js:62:5)
at Object.loadESM (internal/process/esm_loader.js:67:11)
at runMainESM (internal/modules/run_main.js:47:31)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:73:5)
at internal/main/run_main_module.js:17:47 {
code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}
The workflow runs the following steps:
Install Node.js (12.x, 14.x, 16.x)
npm install (with node-dev@^7.0.0)
npm start
It runs node-dev ./index.mjs
When index.mjs is loaded, it import hello from './hello.mjs'
To repro without a Windows box, please fork the repo and see the result of GitHub Actions. 😉
Instead of npm start, I also tried the followings and got same error:
node_modules\.bin\node-dev .
node_modules\.bin\node-dev ./index.mjs
The text was updated successfully, but these errors were encountered:
Description
When running
node-dev ./index.mjs
on Windows, Node.js (14.* and 16.*) will throwERR_UNSUPPORTED_ESM_URL_SCHEME
. It works on Ubuntu.According to doc, I renamed to
.mjs
and I believe this is the only change needed for ESM.Repro steps
I created a repo for bug repro, with GitHub Actions configured to run on both Ubuntu and Windows.
The workflow runs the following steps:
npm install
(withnode-dev@^7.0.0
)npm start
node-dev ./index.mjs
index.mjs
is loaded, itimport hello from './hello.mjs'
To repro without a Windows box, please fork the repo and see the result of GitHub Actions. 😉
Instead of
npm start
, I also tried the followings and got same error:node_modules\.bin\node-dev .
node_modules\.bin\node-dev ./index.mjs
The text was updated successfully, but these errors were encountered: