I was able to reproduce this βerrorβ with only 4 lines below.
var e = new Error('first'); console.log(e); e.message = 'new'; console.log(e);
I tried Chrome 59 and it did not have the same problem.
However, Node 7.9.0, Node 8.0.0 and Node 8.1.2 are all problems.
I reported a bug on GitHub # 13832 so that we could see what came of it.
Update 1 . To show that this is not a time issue, we can add setTimeout calls
var e = new Error('first'); console.log(e); setTimeout(() => { e.message = 'new'; }, 1000); setTimeout(() => console.log(e), 2000);
The problem persists even if we wait to call console.log() , which makes me think that the output is cached.
Update 2 . I got a response from mscdex on GitHub:
It is expected that what you see is a stack trace that includes an error message after creating it. The stack trace is generated lazily and only once (for performance reasons), so you see the same result both times.
If you, however, change your code to e.message output, you will see the expected output change.
Ultimately, both mscdex and Bergi say the main reason is lazy pricing.
What you are doing is probably not a common scenario, so I would not do it in the future, since the node.js command does not appear that will change this behavior.