'How can I downgrade to the specific version of node and npm on mac?

I am trying to downgrade node and npm in Mac for a specific project. Current versions on my system.

npm - v
7.21.1
node -v
v16.9.1

I am trying to downgrade to these specific versions. node v14.16.0 & npm 7.20.0.

Thanks in advance.

I tried doing it with npm install -g 7.20.0 but got the error

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/7.20.0 - Not found
npm ERR! 404 
npm ERR! 404  '7.20.0@*' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

How can I do it? The reference that I could find was the installation process with Homebrew (which I don't want to use).



Solution 1:[1]

Nvm

You can use nvm(node version manager) to use different version of node js based on your project requirements

you can find more information on the official git repo

Usage

You can use nvm to manage different node version inside your system and still keep your latest version, you can also define a default node version for new shell instance.

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