-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
SyntaxError showing token not in the input #6427
Comments
I think this is expected due to Node wrapping your code. |
Yes, the reason it does not point to your var n = 0;
++
n
console.log(n) // Prints `1` |
To be clear, this is not a serious bug for me; I just wanted to report it in case it was indicative of some more important problem. Is this whole "node module wrapper function" behavior documented somewhere? It seems unfortunate that it can lead to such a confusing SyntaxError. But, it might not be worth it to fix this one. |
I'm not sure if it's actually documented. Interestingly enough, the docs do say:
Where "as though" could be interpreted as "because" :-) |
Doesn't seem to be documented anywhere. Might be useful to include so I made a PR: #6433 |
I feel user shouldn't know about this. At least the error shouldn't point to the internally code |
This was closed a while back in 7164003. |
Included a block in the modules.md file to explain the existence and purpose of the module wrapper. PR-URL: #6433 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Evan Lucas <[email protected]> Reviewed-By: James M Snell <[email protected]>
Given
foo.js
just containing the following:++
When I run
node foo.js
, I get:But the token
}
does not appear infoo.js
. This could be related to #3411, not sure. When I run with just v8, I get an appropriate error:The text was updated successfully, but these errors were encountered: