'Install a specific version of node and npm using brew (or not using brew)

I'm trying to set my environment to node v14.18.2 and NPM 7.24.2.

When I brew install node I get npm 8.5.2 and node v17.7.2.

If I change to node@14 formula:

brew unlink node

brew link --overwrite node@14

This gives me node v14.19.1 and npm 6.14.16.

How can I get the exact versions of npm and node I want using brew?

Alternatively, is brew not the way to go for what I'm trying to do?



Solution 1:[1]

I used nvm instead. First install nvm curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash.

Switch to a new terminal.

nvm install 14.18.2

nvm use 14.18.2

npm install -g [email protected]

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dashiell Rose Bark-Huss