Upgraded from node 0.4.11 to 0.6.15, and noticed the REPL (running node with no arguments) keeps dumping "undefined" after most commands or carriages returns...
It's distracting and driving me batty, how do you disable this?
>
undefined
>
undefined
>
undefined
>
undefined
> var x = 2
undefined
> x
2
>
See the Node.js REPL documentation page.
Specifically this:
If
ignoreUndefined
is set to true, then the repl will not output return value of command if it'sundefined
. Defaults tofalse
.
Sample code:
var net = require("net"),
repl = require("repl");
repl.start(null, null, null, null, true);
Sample output:
> var x
> var blah
Additionally you could alias node
to
node -e "require('repl').start(null, null, null, null, true)"
Another way of invoking node without the undefined returns of commands is by:
node -e "require('repl').start({ignoreUndefined: true})"
from the command line