---
title: "Discussion on \"Managing multiple node versions with NVM\" | Hashnode"
description: "Discussion on \"Managing multiple node versions with NVM\". While working on multiple projects, some of them may use different node versions.\nThis can be a real pain point when you accidentally ran npm install or npm update with a different npm version.\nTo address these issues, we get something unique called ..."
url: "https://hashnode.com/posts/managing-multiple-node-versions-with-nvm/62cea318fe5b55d5da426f13"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Managing multiple node versions with NVM](https://h.daily-dev-tips.com/managing-multiple-node-versions-with-nvm?utm_source=hashnode&utm_medium=feed)

While working on multiple projects, some of them may use different node versions. This can be a real pain point when you accidentally ran npm install or npm update with a different npm version. To address these issues, we get something unique called ...

Jul 13, 2022 · 2 min read · h.daily-dev-tips.com  
Read the article

-   [#nodejs](https://hashnode.com/tag/nodejs)
-   [#nvm](https://hashnode.com/tag/nvm)

## Written by

[Chris Bongers](https://hashnode.com/@dailydevtips)

@dailydevtips · Cape Town, SA

  
[View profile](https://hashnode.com/@dailydevtips)

Looking to get into development? As a full-stack developer I guide you on this journey and give you bite sized tips every single day 👊

I'm a full-stack developer from South Africa 🇿🇦. I love writing about JavaScript, HTML and CSS.

## Responses 3

Markdown supported · ⌘↵ to post

[Umair Hafeez](https://hashnode.com/@umairhafeez)

[Jul 15, 2022](https://hashnode.com/posts/managing-multiple-node-versions-with-nvm/62cea318fe5b55d5da426f13/comment/62d1aa122f551b044bc154fa)

NVM is great indeed, thank you for putting this together [Chris Bongers](https://hashnode.com/@dailydevtips).

I use this tiny shell script in my `.zshrc` file that looks for a `.nvmrc` file, and automatically switches to the node version defined there, or falls back to the default one if can't find the file.

```
autoload -U add-zsh-hook
load-nvmrc() {
  local node_version="$(nvm version)"
  local nvmrc_path="$(nvm_find_nvmrc)"

  if [ -n "$nvmrc_path" ]; then
    local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")

    if [ "$nvmrc_node_version" = "N/A" ]; then
      nvm install
    elif [ "$nvmrc_node_version" != "$node_version" ]; then
      nvm use
    fi
  elif [ "$node_version" != "$(nvm version default)" ]; then
    echo "Reverting to nvm default version"
    nvm use default
  fi
}
add-zsh-hook chpwd load-nvmrc
load-nvmrc
```

It will help those who don't use VS Code 🙂

[Donkey Code](https://hashnode.com/@donkeycode)

[Jul 14, 2022](https://hashnode.com/posts/managing-multiple-node-versions-with-nvm/62cea318fe5b55d5da426f13/comment/62cfc153466c6ad9ff5d8acb)

What are your thoughts on Volta as an alternative?

[Umair Hafeez](https://hashnode.com/@umairhafeez)

[Jul 22, 2022](https://hashnode.com/posts/managing-multiple-node-versions-with-nvm/62cea318fe5b55d5da426f13/comment/62cfc153466c6ad9ff5d8acb#reply-62dace94e3738c59b0b7c2bc)

[Lars Gyrup Brink Nielsen](https://hashnode.com/@LayZee) can share his expert opinion about Volta, and this reminds me that I have to try it as well 😆

[Donkey Code](https://hashnode.com/@donkeycode)

[Jul 22, 2022](https://hashnode.com/posts/managing-multiple-node-versions-with-nvm/62cea318fe5b55d5da426f13/comment/62cfc153466c6ad9ff5d8acb#reply-62dae33099a21b6b5b5eb4be)

[Umair Hafeez](https://hashnode.com/@umairhafeez) Give it a crack mate, it's just as easy to use, but more convenient!

[Lars Gyrup Brink Nielsen](https://hashnode.com/@LayZee)

[Jul 23, 2022](https://hashnode.com/posts/managing-multiple-node-versions-with-nvm/62cea318fe5b55d5da426f13/comment/62cfc153466c6ad9ff5d8acb#reply-62dc520c0da9857574b21bd8)

Hi, [Umair Hafeez](https://hashnode.com/@umairhafeez)!

Yes, I use Volta. It is better than NVM in all aspects:

-   Proper cross-platform support (NVM doesn't have full Windows support)
-   No commands needed when a repo config is present. No nvm use, no nvm install.
-   Official GitHub Action: volta/cli-action
-   Fewer updates needed

[Hunter Trammell](https://hashnode.com/@trammellwebdev)

[Jul 13, 2022](https://hashnode.com/posts/managing-multiple-node-versions-with-nvm/62cea318fe5b55d5da426f13/comment/62cececefe5b55d5da427677)

This is so helpful, I’ve been wanting to use this but always get stuck on editing the profile. Thank you!

[Chris Bongers](https://hashnode.com/@dailydevtips)

[Jul 14, 2022](https://hashnode.com/posts/managing-multiple-node-versions-with-nvm/62cea318fe5b55d5da426f13/comment/62cececefe5b55d5da427677#reply-62cfc3e5466c6ad9ff5d8c05)

Happy to hear it helps Hunter
