Skip to content

Install Node.js

Please install Node, version 12 LTS:

brew install node@16

And pin this version:

brew pin node@16

Add node and npm to PATH

The first lines of confirmation will contain something similar:

node@16 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have node@16 first in your PATH run:
  echo 'export PATH="/usr/local/opt/node@16/bin:$PATH"' >> ~/.zshrc

Please execute the suggested command to add the node bin directory to the PATH (this line can be different based in your shell):

echo 'export PATH="$(brew --prefix)/opt/node@16/bin:$PATH"' >> ~/.zshrc

Check the installation

Close the previously active terminal (or source your profile) to have node and npm in your PATH.

Node.js will come with npm as well. You can check if both of them are installed:

node --version
npm --version

You should see something like the following:

v16.19.1
8.19.3