Why error message of node core module disappeared?


#1

I modified vendor/node/lib/fs.js like this:

  • comment const util = require('util');
  • rebuild electron with debug mode
  • then use electron to run an electron project

Electron is blocked, but there is not any error log about fs.js. Now Util is not defined in fs.js, so i think it should be output some error message saying something like Util is not defined.

If i downloaded nodejs from https://github.com/nodejs/node, and modified fs.js, then node will report error message that:

A03101308207:Release minggo$ ./node
fs.js:37
const errnoException = util._errnoException;
                       ^

ReferenceError: util is not defined
    at fs.js:37:24
    at NativeModule.compile (node.js:952:5)
    at NativeModule.require (node.js:900:18)
    at module.js:9:12
    at NativeModule.compile (node.js:952:5)
    at Function.NativeModule.require (node.js:900:18)
    at startup (node.js:138:35)
    at node.js:961:3
A03101308207:Release minggo$ 

So i think the error message of node core module is eaten in electron. I don’t know where the codes is and why do it like this.

Any idea?