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

Reproduce wrong line numbers in stack traces under Node v20 #34

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

gthb
Copy link

@gthb gthb commented Sep 5, 2023

This reproduces the apparent bug (whether the root cause is in ts-node or in Node itself) that under Node v20.0.0 onwards (EDIT: and now also v18.19.0), line numbers are incorrect in stack traces thrown in TypeScript files, seeming to correspond to a module file stripped of its type declarations.

The CI runner failed to install Node v20 (when that was in run.sh, prior to b551e87).

Once I changed that to v18.19.0, the CI output still reports a bunch of cp: cannot remove '/usr/local/include/node/v8-locker.h': Permission denied, but it does seem to finish installing v18.19.0, and the CI output reports the problem I'm reproing (but also some Node internal error/warning):

Grr, stack seems to have wrong line numbers.
node:internal/process/esm_loader:40
      internalBinding('errors').triggerUncaughtException(
                                ^

Error: bar
    at foofn (file:///home/runner/work/ts-node-repros/ts-node-repros/example.ts:2:11)
    at file:///home/runner/work/ts-node-repros/ts-node-repros/example.ts:5:5
    at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:336:24)
    at async loadESM (node:internal/process/esm_loader:34:7)
    at async handleMainPromise (node:internal/modules/run_main:106:12)

Node.js v18.19.0
Process exited with code: 1

(The CI job still reports green, which is a little misleading, but maybe that's the convention in this repo?)

If you change the Node version to v18.8.2 or earlier, the test passes, i.e. the line number will be correct.

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

Successfully merging this pull request may close these issues.

1 participant