-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
v4.0.0 doesn't give file/line for wrong syntax. #2762
Comments
You can start your investigation by examining what's on line 11 in |
I did and my investigation led to the conclusion that SyntaxError doesn't contain file/line information, so I posted here. Line 11 is |
Try removing the unhandled exception callback. I think, if it's a syntax error, you'll get a cleaner stack trace, because the interpreter will break on the exact line and column, where the unexpected identifier was met. |
Can you put the first 15 or so lines of |
You can see the whole file if you like.
https://github.com/Perennials/prototype-js/blob/master/tests/tests.js
|
I will give way to reproduce later when I get to the office.
|
So here is how to reproduce: mkdir dir
cd dir
npm install https://github.com/Perennials/prototype-js/tarball/master
cd node_modules/Prototype
npm install
### Break the syntax somewhere. Edit tests/Function.js:120 and change it to "iface1_decl {}"
npm test And the line that prints the error is |
I too ran into this issue when trying to process a syntax error after adding an I don't see a way to get the fileName or lineNumber information from the error. Using Seems that behavior might be slightly different with these errors on startup versus before. |
Any updates on this? It makes it rather multi-step (annoying) to debug syntax error when using tools like /cc @bnoordhuis @rvagg @mikeal |
cc @nodejs/collaborators could we get more eyes on this? |
This is present in v3 too. Also, the line number in the stack trace is like that in all versions of node. What's wrong is that the extra context info lines are missing. v3/v4:
others:
Notice the bit with the ^ in it. Probably something changed in V8. Not sure if there's anything we can do about it, but I'll let some others have a look. |
This is probably a result of the change in #2108. Strange, I thought we had tests for this... |
Is this going to be considered a regression? |
Currently, when a file with a syntax error is imported in the REPL, no information is provided on the error's location. This commit adds the error's location to the stack trace. Refs: nodejs#2762 Refs: nodejs#3411 Refs: nodejs#3784 PR-URL: nodejs#4013 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Currently, when a file with a syntax error is imported in the REPL, no information is provided on the error's location. This commit adds the error's location to the stack trace. Refs: nodejs#2762 Refs: nodejs#3411 Refs: nodejs#3784 PR-URL: nodejs#4013 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
function buildBundle(args, config, output = outputBundle) { SyntaxError: Unexpected token = |
@nodejs/collaborators ... any further thoughts on this? |
@jasnell I believe this should be fixed in master. |
Closing then, can reopen if it proves necessary. |
Currently, when a file with a syntax error is imported in the REPL, no information is provided on the error's location. This commit adds the error's location to the stack trace. Refs: nodejs#2762 Refs: nodejs#3411 Refs: nodejs#3784 PR-URL: nodejs#4013 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
How can this issue be closed, without a solution over it?
|
@mrahulreddy what version of Node did you see this with? If the issue has been fixed on Could you check whether the latest |
Hello @gibfahn: I am using v4.4.7. Even |
Do you know which PRs should have fixed it? @mrahulreddy the question is whether the changes have been backported to the latest v4 or v6. v4.4.7 definitely won't work, try |
I just verified that this is addressed in node 6 (I tested w/ 6.9.5). The pretty-printed output about the syntax error is included at the top of Specifically: In Node 4.3.0 I get:
Whereas in Node v6.9.5, I get:
|
Make sure that you have installed latest LTS version of nodeJS from https://nodejs.org/
}` |
I'm happily moving some of my stuff to ES6 but when I wrong the syntax I get SyntaxError which goes to my
on( 'unhandledException' )
and I print it to get message like this. Not very helpful.The text was updated successfully, but these errors were encountered: