Why Should You Use Node Version Manager?
Node version manager is useful when you need to work on multiple projects that require different versions of Node.js. This is common in scenarios like:
- Maintaining legacy projects that use older Node versions
- Developing new projects that use the latest Node version
- Contributing to open source projects with specific Node requirements
Without Node version manager, you would need to constantly install/uninstall Node versions, which is inefficient and prone to errors
Requirements:
- Git bash :https://git-scm.com/downloads
- Text Editor
Getting start:
-
Open your bash terminal
-
Run install script
curl -fsSL https://fnm.vercel.app/install | bash
-
Apply changes
source /path-to-your-file/.bashrc
source /path-to-your-file/.bashrc
-
Add below line in .bashrc to auto switch node version (.nvmrc / .node-version) file
eval "$(fnm env --use-on-cd)"
eval "$(fnm env --use-on-cd)"
Useful Command:
Switch Node version
fnm use <node-version>
Checking node version
node --version