What are the important command line options in Node.js?

CWC
3 Min Read

To write a server side application one often needs to come across Linux or UNIX command line. In JavaScript development, Node.js provides an easy way to access raw data passed on the command line with many command line options, and it is an ability of Node.js to create command line utilities. It gives Node.js the real power of Network programming platform.

What is a command line options

A Command-line option is used to modify the operation of a command. In UNIX-like systems, options are often indicated by a hyphen and separated by a space.

Different Command line options in Node.js

Node.js comes with a variety of command line options. One can easily use these options for debugging; execute scripts in multiple ways, and for other helpful runtime options. Generic synopsis of Node.js command line arguments are as follows –

node [options] [v8 options] [script.js | -e "script"] [--] [arguments]

node debug [script.js | -e "script" | <host>:<port>] …

node --v8-options

Options

  1. -v, –version: This represents the version of the node.
  2. -h, –help: Print the node command line options
  3. -e, –eval “script”: Evaluate the following argument as JavaScript
  4. -p, –print “script” : Print the script
  5. -c, –check: Check the syntax of the script before executing it.
  6. -r, –require module: Preload the specified module at startup
  7. –inspect [=host: port]: Activate V8 inspector on a host: port to debug and profile Node.js instances.
  8. –inspect-brk [=host: port]: Activate V8 inspector on a host: port and break at the start of the script.
  9. –no-deprecation: Suppress deprecation warning.
  10. –trace-deprecation: Print the track trace of the deprecation.
  11. –throw-deprecation: Throws error in case of any deprecation
  12. –no-warnings: Suppress all warnings related to process and deprecation.
  13. –trace-warnings: Prints the stack trace of the process warnings including deprecation.
  14. –trace-sync-io: Prints the stack trace for synchronous I/O.
  15. –zero-fill-buffers: Does the zero-fills automatically for all the newly allocated buffers.
  16. –v8-options: Print all V8 command line options.

Above are the command lines options available in Node.js.To get more details on it, one can type the command – man node – which will provide the complete documentation on the command line options for a node.

[vc_row][vc_column][td_block_21 separator=”” tag_slug=”node-js” limit=”40″ tdc_css=””][/vc_column][/vc_row]

TAGGED:
Share This Article
Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

English
Exit mobile version