Command line scripts - wrong error line number
See original GitHub issue👋
I just noticed that if I have:
#!/usr/bin/env node
on top of my file, the error line is not the correct one. The error message itself is correct but the error line number is the next one after the actual error.
Issue Analytics
- State:
- Created 8 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
How do I find the line number in Bash when an error occured?
This works by trapping on ERR and then calling the failure() function with the current line number + bash command that was executed....
Read more >Getting the line number of a shell script error - Stack Overflow
When I run the script I get this error
Read more >ScriptLineNumber shows incorrect line number - AutoIt
I tried only as #Au3Stripper_Parameters=/rsln, but the script gives Variable not declared. I do not get any errors if I remove both the...
Read more >Line number for errors with Python script almost always ...
I am trying to debug a script but the line numbers that Maya shows for errors in my script are frequently wrong. It...
Read more >Writing shell scripts - Lesson 9: Stay Out Of Trouble
We can confirm the validity of this by trying it on the command line: [me@linuxbox me]$ number= [me@linuxbox me]$. See, no error message....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I was too facing this just now. Line number off by 2.
However
retainLines: 'true'
(in babel options) seem to solve it.I’m suspecting babel-polyfill or some other helper function is injecting extra 2 lines.
Funnily I was trying to get rid of that
retainLines
option with this library. great succes/s!I was just passing by, and I thought maybe since this is a command line script you’re making that this might be a conflict with how node works. Before node runs a command script it removes the shebang from the script’s string. That might put your error off by one line.