nodejs
< 1 minute read

How to Install NVM (Node Version Manager)

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash

How to Install Node.js with NVM?

nvm install v12.18.0

How to Set the Default Node.js version with nvm?

nvm alias default v12.18.0

How to Pass command line (CLI) arguments to a Node.js app?

process.argv.forEach((val, index) =&gt; {
  console.log(`${index}: ${val}`);
});

node process-args.js one two=three four

0: /usr/local/bin/node
1: /Users/mjr/work/node/process-args.js
2: one
3: two=three
4: four

How to Start Node.js from the Terminal?

node

How to Exit Node.js

process.exit()

Globals in Node

node

process

require

module

global