Installing npm and Node.js on a Mac OS laptop

1. Install Mac iOS installer from Node.js

2. Downloading and installing Node.js and npm

Checking your version of npm and Node.js§

To see if you already have Node.js and npm installed and check the installed version, run the following commands:

node -v
npm -v

$ node -v

$ npm -v

4. Run this npm install [email protected] -g

npm is a separate project from Node.js. So even if you’ve just downloaded Node.js (which also includes npm), you’ll probably need to update your npm. 

To update your npm, type this into your terminal:

$ sudo npm install [email protected] -g
/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
/usr/local/bin/npx -> /usr/local/lib/node_modules/npm/bin/npx-cli.js
+ [email protected]
updated 1 package in 4.132s

5. Run and check npm version

$ npm - v or 
$ npm - version

Usage: npm <command>

where <command> is one of:
    access, adduser, audit, bin, bugs, c, cache, ci, cit,
    clean-install, clean-install-test, completion, config,
    create, ddp, dedupe, deprecate, dist-tag, docs, doctor,
    edit, explore, get, help, help-search, hook, i, init,
    install, install-ci-test, install-test, it, link, list, ln,
    login, logout, ls, org, outdated, owner, pack, ping, prefix,
    profile, prune, publish, rb, rebuild, repo, restart, root,
    run, run-script, s, se, search, set, shrinkwrap, star,
    stars, start, stop, t, team, test, token, tst, un,
    uninstall, unpublish, unstar, up, update, v, version, view,

npm <command> -h  quick help on <command>
npm -l            display full usage info
npm help <term>   search for help on <term>
npm help npm      involved overview

Specify configs in the ini-formatted file:
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

[email protected] /usr/local/lib/node_modules/npm

For more details, you can refer to:

Get npm!
Install Node.js, npm, and stay up-to-date.

NPM – Downloading and installing Node.js and npm.