$> node -v v9.5.0 $> brew unlink node $> brew link --force node@8 $> node -v v8.9.4
Although you can use dedicated tools to manage your Node.js versions, I’ve got
by just fine using Homebrew’s
nodepackage points at the latest version of Node.js. You can find out exactly which version by running
brew info node:
$> brew info node node: stable 9.5.0 (bottled), HEAD ...
brew install node
Homebrew formulae are available for prior versions of Node.js and follow the
node@<version>naming convention. You can see exactly which version of Node.js a formula points to by using the
$> brew info node@8 node@8: stable 8.9.4 (bottled), HEAD [keg-only] ...
brew install node@8
node@8installed we can switch between them like so:
$> node -v v9.5.0 # <- node is pointing at the node formula $> brew unlink node $> brew link --force node@8 # --force required as node@8 is a keg-only formula $> node -v v8.9.4 # <- node now points at the node@8 formula
To change back to the latest Node.js, just do the opposite to what we’ve just done:
$> brew unlink node@8 $> brew link node $> node -v v9.5.0