diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index 18e1837c0a9bf1..067998f115ccc9 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -28,13 +28,6 @@ const isMainThread = internalBinding('worker').threadId === 0; function startup() { - const EventEmitter = NativeModule.require('events'); - - const origProcProto = Object.getPrototypeOf(process); - Object.setPrototypeOf(origProcProto, EventEmitter.prototype); - - EventEmitter.call(process); - setupProcessObject(); // Do this good and early, since it handles errors. @@ -335,6 +328,11 @@ } function setupProcessObject() { + const EventEmitter = NativeModule.require('events'); + const origProcProto = Object.getPrototypeOf(process); + Object.setPrototypeOf(origProcProto, EventEmitter.prototype); + EventEmitter.call(process); + _setupProcessObject(pushValueToArray); function pushValueToArray() {