{"id":119767,"date":"2026-07-09T16:29:08","date_gmt":"2026-07-09T10:59:08","guid":{"rendered":"https:\/\/www.guvi.in\/blog\/?p=119767"},"modified":"2026-07-09T16:29:09","modified_gmt":"2026-07-09T10:59:09","slug":"how-to-use-nvm-to-switch-node-js-versions","status":"publish","type":"post","link":"https:\/\/www.guvi.in\/blog\/how-to-use-nvm-to-switch-node-js-versions\/","title":{"rendered":"How to Use nvm: Best Guide to Switch Node.js Versions\u00a0"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">TL;DR Summary<\/h2>\n\n\n\n<p>nvm is a Node Version Manager that lets you install, switch, and manage multiple Node.js versions from the command line. To switch versions, install nvm, run nvm install &lt;version&gt;, then use nvm use &lt;version&gt; to activate the required Node.js version. You can also set a default version with nvm alias default &lt;version&gt; and use a .nvmrc file to make teams work on the same version. nvm is especially useful when different projects need different Node.js versions.<\/p>\n\n\n\n<p>nvm helps you switch Node.js versions without uninstalling and reinstalling <a href=\"https:\/\/www.guvi.in\/blog\/guide-for-nodejs-as-backend\/\" target=\"_blank\" rel=\"noreferrer noopener\">Node.js<\/a> again and again.<\/p>\n\n\n\n<p>This is useful because different projects may require different Node.js versions based on their dependencies, frameworks, or deployment environment.<\/p>\n\n\n\n<p>If you are learning JavaScript, <a href=\"https:\/\/www.guvi.in\/blog\/what-is-reactjs\/\" target=\"_blank\" rel=\"noreferrer noopener\">React<\/a>, Node.js, <a href=\"https:\/\/www.guvi.in\/blog\/best-nodejs-frameworks-guide\/\" target=\"_blank\" rel=\"noreferrer noopener\">Express<\/a>, Next.js, or full-stack development, nvm can save you from many version-related errors. In this guide you will learn how to use nvm.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>What is nvm in Node.js?<\/strong><\/h2>\n\n\n\n<p>nvm stands for Node Version Manager.<\/p>\n\n\n\n<p>It is a command-line tool that lets you install and use multiple Node.js versions on the same system.<\/p>\n\n\n\n<p>Instead of depending on one global Node.js installation, you can switch versions based on the project you are working on.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>What does nvm do?<\/strong><\/h3>\n\n\n\n<p><strong>nvm helps you:<\/strong><\/p>\n\n\n\n<ul>\n<li><strong>Install different Node.js versions<\/strong><\/li>\n\n\n\n<li><strong>Switch between Node.js versions<\/strong><\/li>\n\n\n\n<li><strong>Set a default Node.js version<\/strong><\/li>\n\n\n\n<li><strong>Use project-specific versions<\/strong><\/li>\n\n\n\n<li><strong>Test apps on different Node versions<\/strong><\/li>\n\n\n\n<li><strong>Avoid dependency compatibility issues<\/strong><\/li>\n\n\n\n<li><strong>Manage Node.js without disturbing your system installation<\/strong><\/li>\n<\/ul>\n\n\n\n<p>For example, one project may need Node.js 18, while another project may need Node.js 22.<\/p>\n\n\n\n<p>With nvm, you can switch between both versions using simple terminal commands.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Simple Example<\/strong><\/h3>\n\n\n\n<p>Suppose your React project works with Node.js 18.<\/p>\n\n\n\n<p>Your new backend project needs Node.js 22.<\/p>\n\n\n\n<p>Instead of uninstalling Node.js 18 and installing Node.js 22 manually, you can run:<\/p>\n\n\n\n<p>nvm use 18<\/p>\n\n\n\n<p>for the React project and:<\/p>\n\n\n\n<p>nvm use 22<\/p>\n\n\n\n<p>for the backend project.<\/p>\n\n\n\n<p>This keeps your workflow clean and avoids unnecessary setup stress.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Why Should You Use nvm?<\/strong><\/h2>\n\n\n\n<p>You should use nvm because Node.js versions change over time, and not every project works perfectly with the latest version.<\/p>\n\n\n\n<p>Some projects depend on older packages.<\/p>\n\n\n\n<p>Some frameworks need a specific Node.js version.<\/p>\n\n\n\n<p>Some production environments use LTS versions for stability.<\/p>\n\n\n\n<p>nvm helps you match the right Node.js version with the right project.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Key Benefits of nvm<\/strong><\/h3>\n\n\n\n<p>nvm is useful because it lets you:<\/p>\n\n\n\n<ul>\n<li><strong>Work on old and new projects on the same machine<\/strong><\/li>\n\n\n\n<li><strong>Test whether your app works on multiple Node.js versions<\/strong><\/li>\n\n\n\n<li><strong>Match your local setup with production servers<\/strong><\/li>\n\n\n\n<li><strong>Avoid breaking projects after a Node.js update<\/strong><\/li>\n\n\n\n<li><strong>Set project-specific versions using <\/strong><strong>.nvmrc<\/strong><\/li>\n\n\n\n<li><strong>Learn Node.js without worrying about system-level conflicts<\/strong><\/li>\n<\/ul>\n\n\n\n<p>This is especially helpful for students and freshers who work on multiple projects, tutorials, internships, and portfolio apps.<\/p>\n\n\n\n<div style=\"background-color: #099f4e; border: 3px solid #110053; border-radius: 12px; padding: 18px 22px; color: #ffffff; font-size: 18px; font-family: Montserrat, Helvetica, sans-serif; line-height: 1.6; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); max-width: 750px;\"><strong style=\"font-size: 22px; color: #ffffff;\">\ud83d\udca1 Did You Know?<\/strong> <br \/>\n<p><a href=\"https:\/\/nodejs.org\/en\/about\/previous-releases\" target=\"_blank\" rel=\"noopener\"><strong>Node.js o<\/strong><\/a><strong>fficially recommends using Active LTS or Maintenance LTS releases for production applications. LTS releases typically receive critical bug fixes for around 30 months, which is why using <\/strong><strong>nvm install &#8211;lts<\/strong><strong> is safer for serious projects than randomly using the newest Node.js version. <\/strong><\/p>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>nvm vs Manual Node.js Installation: What is the Difference?<\/strong><\/h2>\n\n\n\n<p>nvm and manual Node.js installation both help you use Node.js, but they are not the same.<\/p>\n\n\n\n<p>Manual installation usually gives you one active Node.js version.<\/p>\n\n\n\n<p>nvm lets you keep multiple versions and switch between them whenever needed.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Factor<\/td><td>nvm<\/td><td>Manual Node.js Installation<\/td><\/tr><tr><td>Main purpose<\/td><td>Manage multiple Node.js versions<\/td><td>Install one Node.js version<\/td><\/tr><tr><td>Version switching<\/td><td>Easy with nvm use<\/td><td>Requires reinstalling or changing system setup<\/td><\/tr><tr><td>Best for<\/td><td>Developers working on multiple projects<\/td><td>Beginners using only one project<\/td><\/tr><tr><td>Project-specific version<\/td><td>Possible with .nvmrc<\/td><td>Not built in<\/td><\/tr><tr><td>Default version control<\/td><td>Possible with nvm alias default<\/td><td>Depends on system path<\/td><\/tr><tr><td>Risk of conflicts<\/td><td>Lower when used correctly<\/td><td>Higher if projects need different versions<\/td><\/tr><tr><td>Team workflow<\/td><td>Better because version can be documented<\/td><td>Harder to keep consistent<\/td><\/tr><tr><td>Learning value<\/td><td>Strong for real development workflows<\/td><td>Basic setup only<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Which one should beginners choose?<\/strong><\/h3>\n\n\n\n<p>Choose nvm if you are learning web development seriously or working on more than one project.<\/p>\n\n\n\n<p>Manual installation is fine for a very basic start.<\/p>\n\n\n\n<p>But once you work with React, Node.js, Express, Next.js, or open-source projects, nvm becomes much more useful.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>What Do You Need Before Installing nvm?<\/strong><\/h2>\n\n\n\n<p>Before installing nvm, make sure you understand your operating system, terminal, and <a href=\"https:\/\/www.guvi.in\/blog\/why-git-and-linux-are-non-negotiable\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>basic command-line knowledge<\/strong>.\u00a0<\/a><\/p>\n\n\n\n<p>The original nvm project is made for Unix-like environments.<\/p>\n\n\n\n<p>It works on macOS, Linux, and Windows through WSL.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Prerequisites for macOS and Linux<\/strong><\/h3>\n\n\n\n<p>You need:<\/p>\n\n\n\n<ol>\n<li>Terminal access<\/li>\n\n\n\n<li>curl or wget<\/li>\n\n\n\n<li>Bash or Zsh shell<\/li>\n\n\n\n<li>Basic command-line knowledge<\/li>\n\n\n\n<li>Internet connection<\/li>\n<\/ol>\n\n\n\n<p>Most macOS and Linux systems already have a compatible shell.<\/p>\n\n\n\n<p>If curl or wget is missing, install it first.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>What about Windows users?<\/strong><\/h3>\n\n\n\n<p>The official nvm project works on Windows through <a href=\"https:\/\/www.guvi.in\/blog\/how-to-practice-linux-remotely-on-windows\/\" target=\"_blank\" rel=\"noreferrer noopener\">WSL.<\/a><\/p>\n\n\n\n<p>WSL stands for Windows Subsystem for Linux.<\/p>\n\n\n\n<p>If you want native Windows support, many developers use a separate tool called nvm-windows.<\/p>\n\n\n\n<p>However, nvm-windows is a different project from the official nvm repository.<\/p>\n\n\n\n<p>So, if you are following official nvm commands, use macOS, Linux, or WSL.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to Install nvm Step by Step<\/strong><\/h2>\n\n\n\n<p>The safest way to install nvm is to follow the official nvm GitHub instructions.<\/p>\n\n\n\n<p>Since install commands can change over time, always verify the latest command from the official repository before publishing or teaching it.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 1: Install nvm using curl<\/strong><\/h3>\n\n\n\n<p>Use the official install script format:<\/p>\n\n\n\n<p>curl -o- https:\/\/raw.githubusercontent.com\/nvm-sh\/nvm\/v0.40.5\/install.sh | bash<\/p>\n\n\n\n<p>If you prefer wget, use:<\/p>\n\n\n\n<p>wget -qO- https:\/\/raw.githubusercontent.com\/nvm-sh\/nvm\/v0.40.5\/install.sh | bash<\/p>\n\n\n\n<p>These commands download and run the nvm install script.<\/p>\n\n\n\n<p>The script usually adds nvm configuration to your shell profile file.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 2: Restart your terminal<\/strong><\/h3>\n\n\n\n<p>After installation, close and reopen your terminal.<\/p>\n\n\n\n<p>This reloads your shell configuration.<\/p>\n\n\n\n<p>You can also manually source your profile file if needed.<\/p>\n\n\n\n<p>For Bash:<\/p>\n\n\n\n<p>source ~\/.bashrc<\/p>\n\n\n\n<p>For Zsh:<\/p>\n\n\n\n<p>source ~\/.zshrc<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 3: Verify nvm installation<\/strong><\/h3>\n\n\n\n<p>Run:<\/p>\n\n\n\n<p>nvm &#8211;version<\/p>\n\n\n\n<p>If nvm is installed correctly, you will see a version number.<\/p>\n\n\n\n<p>If you see nvm: command not found, your shell profile may not have loaded the nvm configuration correctly.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to Install Node.js Versions Using nvm<\/strong><\/h2>\n\n\n\n<p>After installing nvm, you can install Node.js versions from the terminal.<\/p>\n\n\n\n<p>You can install the latest version, the latest LTS version, or a specific version.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Install the latest Node.js version<\/strong><\/h3>\n\n\n\n<p>Run:<\/p>\n\n\n\n<p>nvm install node<\/p>\n\n\n\n<p>Here, node is an alias for the latest available Node.js version.<\/p>\n\n\n\n<p>This is useful when you want to test the newest features.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Install the latest LTS version<\/strong><\/h3>\n\n\n\n<p>Run:<\/p>\n\n\n\n<p>nvm install &#8211;lts<\/p>\n\n\n\n<p>LTS stands for Long-Term Support.<\/p>\n\n\n\n<p>For most learners and production projects, LTS versions are safer because they are more stable.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Install a specific Node.js version<\/strong><\/h3>\n\n\n\n<p>Run:<\/p>\n\n\n\n<p>nvm install 22<\/p>\n\n\n\n<p>or:<\/p>\n\n\n\n<p>nvm install 22.12.0<\/p>\n\n\n\n<p>The first command installs the latest available Node.js 22 version.<\/p>\n\n\n\n<p>The second command installs the exact version you mention.<\/p>\n\n\n\n<div style=\"background-color: #099f4e; border: 3px solid #110053; border-radius: 12px; padding: 18px 22px; color: #ffffff; font-size: 18px; font-family: Montserrat, Helvetica, sans-serif; line-height: 1.6; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); max-width: 750px;\"><strong style=\"font-size: 22px; color: #ffffff;\">\ud83d\udca1 Did You Know?<\/strong> <br \/>\n<p><strong>As of 2026, <\/strong><a href=\"https:\/\/nodejs.org\/en\/about\/eol\" target=\"_blank\" rel=\"noopener\"><strong>Node.js 20 reached end-of-life<\/strong><\/a><strong> on April 30, 2026, which means it no longer receives official security patches or bug fixes. This is why tools like nvm are useful: developers can quickly switch from older Node.js versions to supported LTS versions like Node.js 22 or newer when projects need updates.&nbsp;<\/strong><\/p>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to Switch Node.js Versions Using nvm<\/strong><\/h2>\n\n\n\n<p>Switching versions is the main reason developers use nvm.<\/p>\n\n\n\n<p>Once a version is installed, you can activate it with nvm use.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 1: Check installed versions<\/strong><\/h3>\n\n\n\n<p>Run:<\/p>\n\n\n\n<p>nvm ls<\/p>\n\n\n\n<p>This shows the Node.js versions installed on your system.<\/p>\n\n\n\n<p>The active version is usually marked with an arrow.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 2: Switch to a specific version<\/strong><\/h3>\n\n\n\n<p>Run:<\/p>\n\n\n\n<p>nvm use 22<\/p>\n\n\n\n<p>Now check the active Node.js version:<\/p>\n\n\n\n<p>node -v<\/p>\n\n\n\n<p>If the output shows Node.js 22, the switch works..<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 3: Switch to another version<\/strong><\/h3>\n\n\n\n<p>If another project needs Node.js 20, run:<\/p>\n\n\n\n<p>nvm use 20<\/p>\n\n\n\n<p>Then confirm:<\/p>\n\n\n\n<p>node -v<\/p>\n\n\n\n<p>This simple workflow helps you move between projects without changing your system Node.js installation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to Set a Default Node.js Version in nvm<\/strong><\/h2>\n\n\n\n<p>When you open a new terminal, nvm uses the default Node.js version.<\/p>\n\n\n\n<p>You can set this default version using nvm alias default.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Set the latest installed Node.js as default<\/strong><\/h3>\n\n\n\n<p>Run:<\/p>\n\n\n\n<p>nvm alias default node<\/p>\n\n\n\n<p>This points the default version to the latest installed Node.js version.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Set a specific version as default<\/strong><\/h3>\n\n\n\n<p>Run:<\/p>\n\n\n\n<p>nvm alias default 22<\/p>\n\n\n\n<p>or:<\/p>\n\n\n\n<p>nvm alias default 22.12.0<\/p>\n\n\n\n<p>Now every new terminal session will start with that version.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Check your default version<\/strong><\/h3>\n\n\n\n<p>Run:<\/p>\n\n\n\n<p>nvm ls<\/p>\n\n\n\n<p>You will see the default alias in the output.<\/p>\n\n\n\n<p>This is useful when you want your system to always start with the same Node.js version.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to Use .nvmrc for Project-Specific Node.js Versions<\/strong><\/h2>\n\n\n\n<p>A .nvmrc file tells nvm which Node.js version a project needs.<\/p>\n\n\n\n<p>This is useful when multiple developers work on the same project.<\/p>\n\n\n\n<p>It also helps you avoid version mismatch errors.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 1: Create a .nvmrc file<\/strong><\/h3>\n\n\n\n<p>Inside your project folder, create a file named:<\/p>\n\n\n\n<p>.nvmrc<\/p>\n\n\n\n<p>Add the required Node.js version inside it:<\/p>\n\n\n\n<p>22<\/p>\n\n\n\n<p>or:<\/p>\n\n\n\n<p>22.12.0<\/p>\n\n\n\n<p>Do not add extra text.<\/p>\n\n\n\n<p>The file should contain only the version value.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 2: Use the project version<\/strong><\/h3>\n\n\n\n<p>Inside the project folder, run:<\/p>\n\n\n\n<p>nvm use<\/p>\n\n\n\n<p>nvm will read the .nvmrc file and switch to the version written inside it.<\/p>\n\n\n\n<p>If that version is not installed, run:<\/p>\n\n\n\n<p>nvm install<\/p>\n\n\n\n<p>nvm will install the version mentioned in .nvmrc.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 3: Commit .nvmrc to Git<\/strong><\/h3>\n\n\n\n<p>Add .nvmrc to your <a href=\"https:\/\/www.guvi.in\/blog\/how-to-use-github-repositories\/\" target=\"_blank\" rel=\"noreferrer noopener\">project repository.<\/a><\/p>\n\n\n\n<p>This helps your teammates, mentors, or future self use the same Node.js version.<\/p>\n\n\n\n<p>For students, this is a good habit when submitting projects or building portfolio apps.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Useful nvm Commands for Beginners<\/strong><\/h2>\n\n\n\n<p>Here are the most useful nvm commands you will use often.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Task<\/td><td>Command<\/td><\/tr><tr><td>Check nvm version<\/td><td>nvm &#8211;version<\/td><\/tr><tr><td>Install latest Node.js<\/td><td>nvm install node<\/td><\/tr><tr><td>Install latest LTS Node.js<\/td><td>nvm install &#8211;lts<\/td><\/tr><tr><td>Install specific version<\/td><td>nvm install 22<\/td><\/tr><tr><td>Use specific version<\/td><td>nvm use 22<\/td><\/tr><tr><td>Check active Node version<\/td><td>node -v<\/td><\/tr><tr><td>List installed versions<\/td><td>nvm ls<\/td><\/tr><tr><td>List remote versions<\/td><td>nvm ls-remote<\/td><\/tr><tr><td>Set default version<\/td><td>nvm alias default 22<\/td><\/tr><tr><td>Use version from .nvmrc<\/td><td>nvm use<\/td><\/tr><tr><td>Install version from .nvmrc<\/td><td>nvm install<\/td><\/tr><tr><td>Remove a version<\/td><td>nvm uninstall 20<\/td><\/tr><tr><td>Find Node path<\/td><td>nvm which 22<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Beginner Tip<\/strong><\/h3>\n\n\n\n<p>Do not memorise every nvm command at once.<\/p>\n\n\n\n<p>Start with these four:<\/p>\n\n\n\n<p>nvm install<\/p>\n\n\n\n<p>nvm use<\/p>\n\n\n\n<p>nvm ls<\/p>\n\n\n\n<p>node -v<\/p>\n\n\n\n<p>These commands are enough for most beginner workflows.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Real-World Example of Using nvm<\/strong><\/h2>\n\n\n\n<p>Imagine a fresher in Bengaluru is working on three projects.<\/p>\n\n\n\n<p>One is a college React project.<\/p>\n\n\n\n<p>One is a Node.js backend internship project.<\/p>\n\n\n\n<p>One is an open-source <a href=\"https:\/\/www.guvi.in\/blog\/top-nextjs-projects-for-all-levels\/\" target=\"_blank\" rel=\"noreferrer noopener\">Next.js project.<\/a><\/p>\n\n\n\n<p>Each project may need a different Node.js version.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Example: Three projects with different versions<\/strong><\/h3>\n\n\n\n<p>The learner\u2019s system may look like this:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Project<\/td><td>Required Node.js Version<\/td><td>Why<\/td><\/tr><tr><td>College React project<\/td><td>Node.js 18<\/td><td>Older dependencies<\/td><\/tr><tr><td>Internship Express API<\/td><td>Node.js 20<\/td><td>Backend runtime compatibility<\/td><\/tr><tr><td>Open-source Next.js app<\/td><td>Node.js 22<\/td><td>Newer framework requirement<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Without nvm, the learner may keep uninstalling and reinstalling Node.js.<\/p>\n\n\n\n<p>With nvm, the workflow becomes:<\/p>\n\n\n\n<p>cd college-react-app<\/p>\n\n\n\n<p>nvm use 18<\/p>\n\n\n\n<p>npm install<\/p>\n\n\n\n<p>npm start<\/p>\n\n\n\n<p>Then:<\/p>\n\n\n\n<p>cd internship-api<\/p>\n\n\n\n<p>nvm use 20<\/p>\n\n\n\n<p>npm install<\/p>\n\n\n\n<p>npm run dev<\/p>\n\n\n\n<p>And:<\/p>\n\n\n\n<p>cd nextjs-open-source-app<\/p>\n\n\n\n<p>nvm use 22<\/p>\n\n\n\n<p>npm install<\/p>\n\n\n\n<p>npm run dev<\/p>\n\n\n\n<p>This is how developers manage multiple real-world projects without breaking their setup.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Common Mistakes to Avoid While Using nvm<\/strong><\/h2>\n\n\n\n<p>nvm is simple once installed, but beginners often face a few common errors.<\/p>\n\n\n\n<p>Most of these issues happen because the shell is not configured properly or the wrong Node.js version is active.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1. Forgetting to restart the terminal<\/strong><\/h3>\n\n\n\n<p>After installing nvm, many beginners immediately run nvm &#8211;version.<\/p>\n\n\n\n<p>If the shell profile is not reloaded, the command may fail.<\/p>\n\n\n\n<p>Fix it by restarting the terminal or running source ~\/.bashrc or source ~\/.zshrc.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2. Using official nvm commands directly on native Windows<\/strong><\/h3>\n\n\n\n<p>The official nvm project is for POSIX shells.<\/p>\n\n\n\n<p>It works on macOS, Linux, and Windows WSL.<\/p>\n\n\n\n<p>If you are using native Windows Command Prompt or PowerShell, use a Windows-compatible version manager such as nvm-windows instead.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3. Installing Node.js but not switching to it<\/strong><\/h3>\n\n\n\n<p>Running nvm install 22 installs Node.js 22.<\/p>\n\n\n\n<p>But your current terminal may still use another version.<\/p>\n\n\n\n<p>Run nvm use 22 and confirm with node -v.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4. Not setting a default Node.js version<\/strong><\/h3>\n\n\n\n<p>If you do not set a default version, new terminals may not use the version you expect.<\/p>\n\n\n\n<p>Fix this with:<\/p>\n\n\n\n<p>nvm alias default 22<\/p>\n\n\n\n<p>This makes your preferred version active in new shell sessions.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>5. Ignoring the .nvmrc file<\/strong><\/h3>\n\n\n\n<p>Many projects mention the required Node.js version in .nvmrc.<\/p>\n\n\n\n<p>If you ignore it, you may face dependency errors.<\/p>\n\n\n\n<p>Always check for .nvmrc when cloning a project.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Best Practices for Using nvm<\/strong><\/h2>\n\n\n\n<p>Using nvm properly helps you avoid setup issues and project conflicts.<\/p>\n\n\n\n<p>These habits are useful for students, freshers, and working developers.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Use LTS versions for serious projects<\/strong><\/h3>\n\n\n\n<p>For production-like projects, prefer Node.js LTS versions.<\/p>\n\n\n\n<p>LTS versions are more stable and better suited for long-term projects.<\/p>\n\n\n\n<p>Use:<\/p>\n\n\n\n<p>nvm install &#8211;lts<\/p>\n\n\n\n<p>when you are unsure which version to choose.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Add .nvmrc to every serious project<\/strong><\/h3>\n\n\n\n<p>Add a .nvmrc file to your project root.<\/p>\n\n\n\n<p>This helps everyone use the same Node.js version.<\/p>\n\n\n\n<p>It also makes your project easier to run after months.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Check Node version before installing packages<\/strong><\/h3>\n\n\n\n<p>Before running npm install, check the active version:<\/p>\n\n\n\n<p>node -v<\/p>\n\n\n\n<p>This avoids installing dependencies under the wrong Node.js version.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Keep global packages limited<\/strong><\/h3>\n\n\n\n<p>Avoid installing too many global npm packages.<\/p>\n\n\n\n<p>Global packages may behave differently across Node.js versions.<\/p>\n\n\n\n<p>Prefer project-level dependencies whenever possible.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Document setup steps in <\/strong><a href=\"https:\/\/www.guvi.in\/blog\/steps-to-upload-your-project-to-github-using-git\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>README<\/strong><\/a><\/h3>\n\n\n\n<p>Add a short setup section to your project README.<\/p>\n\n\n\n<p>For example:<\/p>\n\n\n\n<p>nvm use<\/p>\n\n\n\n<p>npm install<\/p>\n\n\n\n<p>npm run dev<\/p>\n\n\n\n<p>This makes your project more professional and easier for others to run.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Career Relevance: Why nvm Matters for Learners<\/strong><\/h2>\n\n\n\n<p>nvm is a small tool, but it teaches an important developer habit: environment management.<\/p>\n\n\n\n<p>In real jobs, developers work with many repositories, frameworks, and deployment environments.<\/p>\n\n\n\n<p>Each may need a different Node.js version.<\/p>\n\n\n\n<p>If you know how to use nvm, you can debug setup issues faster and work more confidently on JavaScript projects.<\/p>\n\n\n\n<p>For freshers, this is useful in internships, open-source contributions, backend projects, React projects, and full-stack developer roles.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Skills you build by using nvm<\/strong><\/h3>\n\n\n\n<p>By using nvm, you learn:<\/p>\n\n\n\n<ul>\n<li>Node.js version management<\/li>\n\n\n\n<li>Terminal basics<\/li>\n\n\n\n<li>Project setup workflow<\/li>\n\n\n\n<li>Dependency compatibility<\/li>\n\n\n\n<li>.nvmrc usage<\/li>\n\n\n\n<li>Team development habits<\/li>\n\n\n\n<li>Debugging setup errors<\/li>\n\n\n\n<li>Full-stack project readiness<\/li>\n<\/ul>\n\n\n\n<p>These skills may look small, but they make your <a href=\"https:\/\/www.guvi.in\/blog\/github-replit-developer-productivity\/\" target=\"_blank\" rel=\"noreferrer noopener\">development workflow<\/a> much more professional.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Build Full Stack Skills With HCL GUVI<\/strong><\/h2>\n\n\n\n<p>nvm helps you manage different Node.js versions smoothly, especially when working on React, Express, Next.js, and full-stack projects. But to build real-world applications confidently, you also need strong foundations in JavaScript, backend development, APIs, databases, Git, debugging, and deployment.<\/p>\n\n\n\n<p>Explore <a href=\"https:\/\/www.guvi.in\/zen-class\/full-stack-development-course\/?utm_source=blog&amp;utm_medium=hyperlink&amp;utm_campaign=How+to+Use+nvm%3A+Best+Guide+to+Switch+Node.js+Versions\" target=\"_blank\" rel=\"noreferrer noopener\">HCL GUVI\u2019s <strong>Full Stack Development Course<\/strong> <\/a>to build practical development skills through hands-on projects, mentor-led learning, and career-focused training.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p>nvm is one of the simplest tools for managing multiple Node.js versions on the same system. It helps you install, switch, and set default Node.js versions without disturbing your project setup. For beginners, the most useful commands are nvm install, nvm use, nvm ls, and node -v. As you work on React, Node.js, Express, or Next.js projects, using .nvmrc will help you maintain version consistency. Learn nvm early because version management is a real-world skill every <a href=\"https:\/\/www.guvi.in\/blog\/typescript-vs-javascript-which-is-best\/\" target=\"_blank\" rel=\"noreferrer noopener\">JavaScript developer<\/a> needs.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">FAQS<\/h2>\n\n\n<div id=\"rank-math-faq\" class=\"rank-math-block\">\n<div class=\"rank-math-list \">\n<div id=\"faq-question-1782815846291\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><strong>1. What is nvm used for?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>nvm is used to install, switch, and manage multiple Node.js versions on the same system. It helps developers use the right Node.js version for each project.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1782815857592\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><strong>2. How do I switch Node.js versions using nvm?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Use nvm use &lt;version> to switch Node.js versions. For example, nvm use 22 switches your terminal to Node.js 22 if it is already installed.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1782815869360\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><strong>3. How do I install a Node.js version with nvm?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Use nvm install &lt;version> to install a specific Node.js version. For example, nvm install 22 installs the latest available Node.js 22 version.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1782815882682\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><strong>4. How do I check my current Node.js version?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Run node -v in your terminal. This shows the currently active Node.js version.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1782815893690\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><strong>5. How do I set a default Node.js version in nvm?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Use nvm alias default &lt;version> to set a default version. For example, nvm alias default 22 makes Node.js 22 the default in new terminals.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1782815904737\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><strong>6. What is a .nvmrc file?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>A .nvmrc file stores the Node.js version required by a project. When you run nvm use inside that project, nvm reads the file and switches to that version.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1782815915767\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><strong>7. Does nvm work on Windows?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>The official nvm project works on Windows through WSL. For native Windows Command Prompt or PowerShell, developers usually use a separate tool called nvm-windows.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1782815926975\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><strong>8. Should I use the latest Node.js version or LTS?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Use LTS for serious projects because it is more stable. Use the latest version mainly when you want to test new features.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1782815940944\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><strong>9. Why is nvm command not found after installation?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>This usually happens when your terminal has not loaded the nvm configuration. Restart the terminal or source your shell profile file such as ~\/.bashrc or ~\/.zshrc.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1782815952287\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><strong>10. Can I use nvm for React and Next.js projects?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Yes, nvm is very useful for React, Next.js, Express, and Node.js projects. It helps you match the Node.js version required by each project.<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>TL;DR Summary nvm is a Node Version Manager that lets you install, switch, and manage multiple Node.js versions from the command line. To switch versions, install nvm, run nvm install &lt;version&gt;, then use nvm use &lt;version&gt; to activate the required Node.js version. You can also set a default version with nvm alias default &lt;version&gt; and [&hellip;]<\/p>\n","protected":false},"author":76,"featured_media":122372,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[294],"tags":[],"views":"23","authorinfo":{"name":"Reemsha Khan","url":"https:\/\/www.guvi.in\/blog\/author\/reemsha-khan\/"},"thumbnailURL":"https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2026\/06\/how-to-use-nvm-300x116.webp","_links":{"self":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts\/119767"}],"collection":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/users\/76"}],"replies":[{"embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/comments?post=119767"}],"version-history":[{"count":4,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts\/119767\/revisions"}],"predecessor-version":[{"id":122375,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts\/119767\/revisions\/122375"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/media\/122372"}],"wp:attachment":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/media?parent=119767"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/categories?post=119767"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/tags?post=119767"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}