diff --git a/lib/internal/bootstrap_node.js b/lib/internal/bootstrap_node.js index 2a6e4290e0fc..21440bf76165 100644 --- a/lib/internal/bootstrap_node.js +++ b/lib/internal/bootstrap_node.js @@ -221,10 +221,12 @@ } else if (!process._allowRepl && NativeModule.require('tty').isatty(0)) { - if (process._eval != null) { - // User passed '-e' or '--eval' - evalScript('[eval]'); - } + // We are on an interactive terminal but don't allow the REPL to + // start. This is the usual case if Node is used as a shared library. + // Calling evalScript is necessary however, because it sets + // globals.require to the require function. + // Otherwise, require doesn't work. + evalScript('[eval]'); } else { // Read all of stdin - execute it. process.stdin.setEncoding('utf8');