Node.js cheat sheet cover image

Node.js Cheat Sheet

Alex Alykiotis

Tags:

English

About

Node.js is a server-side JavaScript runtime that makes it easy to build fast, scalable network applications. Many enterprise companies have adopted Node.js because of its event-driven, non-blocking I/O model, which makes it lightweight and efficient.

This cheat sheet helps developers master the most useful command-line flags to customize Node.js’s behavior. You’ll save time and energy looking up how to do everyday development tasks like executing scripts, debugging, and monitoring your Node.js applications.

In this cheat sheet, you will learn how to:

  • Perform JavaScript syntax checks.
  • Quickly test code with the Node.js REPL.
  • Require specific modules at startup.
  • Automatically detect deprecated APIs and trace warnings.
  • Catch production problems like slow performance and memory leaks with diagnostic reports.
  • Investigate Node.js process memory use with the garbage collector and heap snapshots.
  • Collect CPU metrics to understand Node.js application performance.
  • Initialize the built-in debugger to troubleshoot Node.js applications and scripts.

Excerpt

-v, --version: Prints the current version of node.js you use

-e, --eval: Evaluates the current argument as JavaScript

-c, --check: Checks the syntax of a script without executing it

-i, --interactive: Opens the node.js REPL (Read-Eval-Print-Loop)

-r, --require: Pre-loads a specic module at start-up

Related Cheat sheets