node.js -e vs node.js -p

30 Jul 2013

The difference between node -e and node -p is p will run the script through the interpreter and print the results. The -e will only evaluate the script. The time -e will print anything is if something writes to stdout or stderr.

node.js -p

node -p "var a"
undefined

node.js -e

node -e "var a"
#nothing

node.js --prof

node --prof process v8 profiler output generated

This runs the v8 profiler and generates a log of every allocation, address, and things on the stack.

node.js -g

Well someone is searching for this, and I'm sorry to say, it isn't a valid command :(

Content is published under this license.