Node on MacOS
Node.js stack involves multiple participants…
npm
npm is:
- online repo for Node.js projects
- dependency manager
E.g. to get documentation for module n:
npm docs n
Use n - see below - for version management. Yet to upgrade to the latest:
sudo npm install -g npm@latest
n
n is an interactive Node.js version manager
Install it with
brew install n
Downgrade it:
$ npm install -g n
$ sudo n 16.13.2
$ sudo n
installed : v16.13.2 (with npm 8.1.2)
$ node -v
v16.13.2
Typical use:
sudo n install 16.15.1
yarn
yarn, or Yet Another Resource Navigator, is a package manager for Node.js developed by Facebook. yarn-vs-npm
Install it:
npm install -g yarn