question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:open
  • Created 8 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
laggingreflexcommented, Nov 19, 2015

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!

0reactions
hollowdoorcommented, Dec 19, 2016

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found