It seems likely there is something about the context of your code that is confusing you. We could help you figure that out if you showed us the context of this code and if you change what the second console.log('test'); outputs so you could tell the difference between the second log statement executing vs. your code just getting called twice (which is my guess).

And, as a vanilla test of your node installation, I'd suggest that you take this set of code and put it in a file named throw-test.js and run just that file:

That's exactly what I see in my running node.js and is what would be expected.

Other things that could be confusing the situation:

Your code might be getting called twice and that's why you get the output you get.

Your code might be inside an async callback that eats exceptions (that's why you don't see any exception logged).

You have a console.log('test') somewhere else in your code and that's why you see two of them.

As for your other comment, the code:

console.log(nonExistent);

will throw a ReferenceError exception. Whether you see that exception or not in your logs depends upon where this code is. Again, if it's inside an async callback, the exception may be eaten (depends upon the specific callback).