diff --git a/lib/internal/repl.js b/lib/internal/repl.js index 6fc5eefc1ba6d8..f2fea166a61d93 100644 --- a/lib/internal/repl.js +++ b/lib/internal/repl.js @@ -57,7 +57,7 @@ function createRepl(env, cb) { } const repl = REPL.start(opts); - if (env.NODE_REPL_HISTORY_PATH) { + if (opts.terminal && env.NODE_REPL_HISTORY_PATH) { return setupHistory(repl, env.NODE_REPL_HISTORY_PATH, cb); } repl._historyPrev = _replHistoryMessage;