- How to install specific NodeJS version
- How do I downgrade node or install a specific previous version using homebrew?
Current linked node version,
$ brew search node
==> Formulae
libbitcoin-node node node-sass node@12 ✔ node_exporter nodeenv
llnode node-build node@10 node@14 nodebrew nodenv
To unlink from current version
$ brew unlink node@12
and uninstall current node version
$ brew uninstall node@12
Install specific version,
$ brew install node@14
node@14 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@14 first in your PATH run:
echo 'export PATH="/usr/local/opt/node@14/bin:$PATH"' >> ~/.zshrc
For compilers to find node@14 you may need to set:
export LDFLAGS="-L/usr/local/opt/node@14/lib"
export CPPFLAGS="-I/usr/local/opt/node@14/include"
To link installed version
$ brew link --overwrite node@14
or
$ brew link --force --overwrite node@14
Update NPM
$ npm install --force npm@latest -g
Ensure
$ node -v
v14.15.1
$ npm -v
7.5.6