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

ts-node CLI loads original domain module - thus raising error #20

Open
ORESoftware opened this issue Nov 2, 2023 · 0 comments
Open

Comments

@ORESoftware
Copy link

ORESoftware commented Nov 2, 2023

I have a script.ts, when I run it (script.js) with node, no problem, but when I run ts-node directly against script.ts, I get this error:

alex.mills@alex domain-haven % ts-node /Users/alex.mills/codes/oresoftware/domain-haven/test/src/perf/simple-perf-server.ts
{ d: 'async-hook-domain' }
app is listening.
caught an error Error: a
    at Timeout._onTimeout (/Users/alex.mills/codes/oresoftware/domain-haven/test/src/perf/simple-perf-server.ts:45:14)
    at listOnTimeout (node:internal/timers:573:17)
    at processTimers (node:internal/timers:514:7)
node:domain:136
  throw err;
  ^

Error [ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE]: The `domain` module is in use, which is mutually exclusive with calling process.setUncaughtExceptionCaptureCallback()
    at new NodeError (node:internal/errors:405:5)
    at process.setUncaughtExceptionCaptureCallback (node:domain:134:15)
    at process.domainErrorHandler (/Users/alex.mills/codes/oresoftware/domain-haven/node_modules/async-hook-domain/src/index.ts:140:12)
    at process.emit (node:events:514:28)
    at process.emit (node:domain:489:12)
    at process.emit.sharedData.processEmitHook.installedValue (/Users/alex.mills/.nvm/versions/node/v20.5.1/lib/node_modules/ts-node/node_modules/@cspotcode/source-map-support/source-map-support.js:745:40)
    at process.domainProcessEmit [as emit] (/Users/alex.mills/codes/oresoftware/domain-haven/node_modules/async-hook-domain/src/index.ts:100:32)
    at process._fatalException (node:internal/process/execution:156:13)
----------------------------------------
Error: require(`domain`) at this point
    at node:domain:130:28
    at BuiltinModule.compileForInternalLoader (node:internal/bootstrap/realm:392:7)
    at requireBuiltin (node:internal/bootstrap/realm:423:14)
    at node:repl:140:16
    at BuiltinModule.compileForInternalLoader (node:internal/bootstrap/realm:392:7)
    at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:328:10)
    at loadBuiltinModule (node:internal/modules/helpers:68:7)
    at Module._load (node:internal/modules/cjs/loader:916:17)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18) {
  code: 'ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE'
}

Node.js v20.5.1

this is sadly a weird one, not sure why ts-node would load domain somewhere, whereas transpiling wouldn't -
but it could also lead to a fruitful discussion somewhere too.

Using Node.js 20.5.1 everywhere here.

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

1 participant