Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 'c:' #8

Closed
binary64 opened this issue Dec 17, 2021 · 2 comments

Comments

@binary64
Copy link

binary64 commented Dec 17, 2021

On Windows, in an Nx repo, using pnpm, I get this error:

$ pnpm esrun tools/test.ts
node:internal/errors:464
    ErrorCaptureStackTrace(err);
    ^

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 'c:'
    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 ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
    at link (node:internal/modules/esm/module_job:75:36) {
  code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}

tools/test.ts:-

import * as R from 'rambda'

console.log(R.add(2, 5))

If I do ts-node tools/test.ts, it works as expected:

$ pnpm ts-node tools/test.ts
7

I am using:

  • Windows 👎
  • "@digitak/esrun": "^3.1.0"
  • pnpm
  • nx.dev

$ node -v
v16.13.0

@fschwalm
Copy link

fschwalm commented May 20, 2022

hello!
have you solved this issue?

UPDATE

The latest version(3.2.4) fix this problem!

@Gin-Quin
Copy link
Contributor

Thank you for letting me know! I fixed it by mistake then 😝 I'm closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants