Clear command history of NodeJS REPL Console Clear command history of NodeJS REPL Console node.js node.js

Clear command history of NodeJS REPL Console


The answer is actually simple :)

On Windows (my version is 10):

  1. go to user folder: cd %userprofile%
  2. empty file named .node_repl_history (in my case with vim text-editor) OR you can simple run: echo. > .node_repl_history and it will have same effect.


Per the nodejs documentation which can be found at the following link:

nodejs repl

Environment Variable Options

The built-in repl (invoked by running node or node -i) may be controlled via the following environment variables:

NODE_REPL_HISTORY - When a valid path is given, persistent REPL history will be saved to the specified file rather than .node_repl_history in the user's home directory. Setting this value to "" will disable persistent REPL history. NODE_REPL_HISTORY_SIZE - defaults to 1000. Controls how many lines of history will be persisted if history is available. Must be a positive number. NODE_REPL_MODE - may be any of sloppy, strict, or magic. Defaults to magic, which will automatically run "strict mode only" statements in strict mode.

Persistent History

By default, the REPL will persist history between node REPL sessions by saving to a .node_repl_history file in the user's home directory. This can be disabled by setting the environment variable NODE_REPL_HISTORY="".