I am using NodeJS version 4.2.1
I want to know the command for clearing the NodeJS REPL console history completely so it doesn't show previously executed commands when Up or Down arrow keys are pressed.
Any suggestions ?
I am using NodeJS version 4.2.1
I want to know the command for clearing the NodeJS REPL console history completely so it doesn't show previously executed commands when Up or Down arrow keys are pressed.
Any suggestions ?
The answer is actually simple :)
On Windows (my version is 10):
cd %userprofile%
echo. > .node_repl_history
and it will have same effect.~/.node_repl_history
–
Sneaking Per the nodejs documentation which can be found at the following link:
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="".
In your node js server just do like this :
app.listen(5600,() => {
console.clear();
console.log('Server app listening on port 5600');
});
© 2022 - 2024 — McMap. All rights reserved.