Node.js

Node.js is a JavaScript runtime built on Chrome’s V8 JavaScript engine.

Installation

Using Homebrew

brew install node

Using Node Version Manager (nvm)

Download and install nvm by running:

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

or via Homebrew:

brew install nvm

Then download Node and select your version by running:

source ~/.bashrc        # source your bashrc/zshrc to add nvm to PATH
command -v nvm          # check the nvm use message
nvm install node        # install most recent Node stable version
nvm ls                  # list installed Node version
nvm use node            # use stable as current version
nvm ls-remote           # list all the Node versions you can install
nvm alias default node  # set the installed stable version as the default Node

See the documentation for information.

npm usage

To install a package:

npm install <package> # Install locally
npm install -g <package> # Install globally

To install a package and save it in your project’s package.json file:

npm install <package> --save

To see what’s installed:

npm list [-g]

To find outdated packages:

npm outdated [-g]

To upgrade all or a particular package:

npm update [-g] [<package>]

To uninstall a package:

npm uninstall [-g] <package>

yarn

Yarn is another package manager built by Facebook. Yarn stands for Yet Another Resource Negotiator. It provides similar functionalities as NPM. It is an alternative to NPM when installing, uninstalling, and managing package dependencies from the NPM registry or GitHub repositories.

brew install yarn

Licenses and Attributions


Speak Your Mind

-->