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
{{ message }}
Repository navigation
Missing source marker on error throw by vm module with --enable-source-maps #39149
Executing the snippet will display the source code line with the marker ^ where the error happened:
main:1
Math.max(a, b
^
SyntaxError: missing ) after argument list
at new Script (vm.js:101:7)
...
But when executing node with --enable-source-maps the source code line with the marker is not displayed:
SyntaxError: missing ) after argument list
at new Script (vm.js:101:7)
...
How often does it reproduce? Is there a required condition?
It does always reproduce. I have tested on node 14.17.0, 16.1.0 and 16.4.0.
What is the expected behavior?
Always display the source location with the marker ^ no matter whether --enable-source-maps is set or not.
What do you see instead?
Additional information
On node 14.16.1 the source code line with the marker is always displayed no matter whether --enable-source-maps is set or not. I have looked into the Changelog and I think that maybe #33491 has introduced this bug.
Prior to #33491 no attempt was made to include a source marker in error output ... so I don't think it introduced the bug, so much as this must be an edge case it doesn't support.
We'll need to dig into this, thanks for the report.
@aduh95@bcoe In case it helps we are having the same problem on v16.14.0 and v14.19.0 however v14.16.0 works correctly. I am able to replicate with just one character.
test.js
{
What is the expected behavior?
>>> node test.js
test.js:1
{
SyntaxError: Unexpected end of input
at wrapSafe (internal/modules/cjs/loader.js:1001:16)
at Module._compile (internal/modules/cjs/loader.js:1049:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)
at internal/main/run_main_module.js:17:47
What do you see instead?
>>> node --enable-source-maps test.js
SyntaxError: Unexpected end of input
at wrapSafe (internal/modules/cjs/loader.js:1001:16)
at Module._compile (internal/modules/cjs/loader.js:1049:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)
at internal/main/run_main_module.js:17:47
Activity
aduh95 commentedon Jun 25, 2021
@bcoe FYI
bcoe commentedon Jun 25, 2021
Prior to #33491 no attempt was made to include a source marker in error output ... so I don't think it introduced the bug, so much as this must be an edge case it doesn't support.
We'll need to dig into this, thanks for the report.
mediapartners commentedon Mar 19, 2022
@aduh95 @bcoe In case it helps we are having the same problem on v16.14.0 and v14.19.0 however v14.16.0 works correctly. I am able to replicate with just one character.
test.js
What is the expected behavior?
What do you see instead?
bcoe commentedon Mar 20, 2022
We have logic that reads the original source of disk when an error occurs, and uses it to place the source marker, here:
https://github.com/nodejs/node/blob/master/lib/internal/source_map/prepare_stack_trace.js#L173
Will need to dig into if there's way for us to figure out this info in the
prepareStackTracemethod.gabrielcsapo commentedon Jun 13, 2022
We are seeing this same issue using vm here ember-fastboot/ember-cli-fastboot#894, thanks for the PR @cola119 !
SebasQuirogaUCP commentedon Aug 26, 2022
Is still help needed?
cola119 commentedon Aug 27, 2022
Fixed in v18.7.0