From 96d228c611ff25ba4923698c39bfe567bc8a18ce Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Sun, 7 May 2017 13:59:49 +0200 Subject: [PATCH] lib: add guard to originalConsole Currently when building --without-ssl or --without-inspector there will be an error when trying to set up the console in bootstrap_node.js: Can't determine the arch of: 'out/Release/node' bootstrap_node.js:276 if (!globalConsole.hasOwnProperty(key)) ^ TypeError: Cannot read property 'hasOwnProperty' of undefined at installInspectorConsole (bootstrap_node.js:276:25) at get (bootstrap_node.js:264:21) at evalScript (bootstrap_node.js:395:30) at startup (bootstrap_node.js:125:9) at bootstrap_node.js:537:3 I think this issue was introduced in commit 3f48ab30420981f888ff2c69fc1ea5abb37f3f2e ("inspector: do not add 'inspector' property"). This commit attempts to fix this. --- lib/internal/bootstrap_node.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/internal/bootstrap_node.js b/lib/internal/bootstrap_node.js index 67a7c109198a50..1ff14ce7f16066 100644 --- a/lib/internal/bootstrap_node.js +++ b/lib/internal/bootstrap_node.js @@ -261,7 +261,9 @@ enumerable: true, get: function() { if (!console) { - console = installInspectorConsole(originalConsole); + console = originalConsole === undefined ? + NativeModule.require('console') : + installInspectorConsole(originalConsole); } return console; }