A
A
Alexander Knyazev2017-02-16 14:33:10
JavaScript
Alexander Knyazev, 2017-02-16 14:33:10

How to print errors to the console in Node.js, even if the error is in a file included with require?

Just an example:
I insert the line into my index.js:
console.log(22)l
As you can see, the error after the closing bracket is not a colon. When I try to run node js, I immediately get an error, and it is indicated in which line it is.
If I add the same code to a file included in index.js using require, then the script just hangs. No errors, just nothing gets executed.
How can I make node give me errors on all files?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Danil, 2017-02-16
@Veneomin

Wangyu: the main script is waiting for a response from the connected script. Connected took off with an error and nothing does not respond.
In fact: the code in the studio.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question