node -e 参数

https://nodejs.org/api/cli.html#cli_e_eval_script

Evaluate the following argument as JavaScript. The modules which are predefined in the REPL can also be used in script.

On Windows, using cmd.exe a single quote will not work correctly because it only recognizes double " for quoting. In Powershell or Git bash, both ' and " are usable.

node -e 可以直接执行一段js脚本并输入 例如

 node -e 'console.log("a")'

你可能感兴趣的:(nodejs)