Node.js

Node.js #

Install nodebrew (using Homebrew) #

  • nodebrew is the package manager for Node.js.
  • You can install multiple versions of Node.js and switch between them etc.
$ brew install nodebrew
$ which nodebrew
/usr/local/bin/nodebrew
$ nodebrew -v
nodebrew 1.1.0
$ nodebrew setup
...

Install Node.js #

Check installable versions #

$ nodebrew ls-remote

Install #

$ nodebrew install-binary latest

Check current version #

$ nodebrew ls
v16.10.0

current: none

Apply specific version #

$ nodebrew use v16.10.0
use v16.10.0

Check current version again #

$ nodebrew ls
v16.10.0

current: v16.10.0

Create an environment path #

$ echo 'export PATH=$HOME/.nodebrew/current/bin:$PATH' >> ~/.bash_profile
$ source ~/.bash_profile

Check if we use node #

$ node -v
v16.10.0