Manage Multiple Node Versions with nvm [Mac, Windows, Linux - 2023]
HTML-код
- Опубликовано: 1 авг 2024
- If you're working on multiple projects, some might have different node version requirements. This happens a lot for Open Source contributors! Let's see how to quickly switch between them with a tool called nvm and leverage the .nvmrc file to make it 100% seamless!
It's available on all OS, including Windows, Linux, and MacOS.
Do not get confused though, Windows has its own version, slightly different from the one for Unix systems:
- Windows: github.com/coreybutler/nvm-wi...
- Linux/MacOS: github.com/nvm-sh/nvm
In short, they both use nvm as a terminal command, so for basic usage you won't find many differences. For advanced users though, you may notice something. Make sure to read the docs in the README.md file of each repository.
_______________________________
Hit like and subscribe for more content! :D
Join the Discord community! Here's the invite: / discord
You can also follow me on the other platforms:
Twitter: / balastrong
dev.to: dev.to/balastrong
TikTok: / balastrong
GitHub: github.com/Balastrong
Instagram: / devbalastrong
_______________________________
TIMESTAMPS
00:00 The Problem
00:33 The Solution: nvm
02:31 nvmrc makes it Automatic
04:46 Windows, Linux & MacOS remarks
05:31 Install Linux & MacOS
06:15 Install Windows
06:27 Extra nvm info
07:13 More interesting content
_______________________________
Sound effects from www.zapsplat.com
#nodejs #programming #opensource Наука
That's a very informative video on Multiple Node Versions with nvm, thanks Leonardo for this ✨
Thank you, glad to hear that! :D
very useful, thanks!
Thank you! And welcome to my channel :D
hey, whats the vscode extension that u're using for suggestions in terminal?
what about specifying a specific version of node in the dependencies section of package.json?
"devDependencies": {
"node": "12.22.12",
This worked for me in a project that used node-sass, which caused npm install to fail.
Suggest NVS (Node Version Switcher) - much easier to use (i.e. for junior engineers) very well maintained
Hey Dino, thanks for the suggestion! It's funny because after publishing this video (and also the blog) I received a lot of comments with nvm alternatives. I should definitely check all of them out :D
Thank you again!
what about the script in windows is it the same to automatically switch ???
I don't know if there's an "official" way to do so, but should be possible as it's nothing else than a simple script executed when a terminal is launched or moved to a new folder :)
Hey Leo, the automatic thing for switching to node version specified in .nvmrc is not working. I created .bashrc file in my home dir. I also created this .zshrc in home dir. I pasted appropriate code for both of them from the git repo you showed. However, when I switch to a dir wich does have .nvmrc file the node version is not automatically switching I have to run "nvm use". And yes the node version specified in .nvmrc is installed on my system. I am just a bit confuse. I want that automatic thing that you have. Any help from anyone would be helpful.
Heyhey! Are you on Windows? If I'm not mistaken on the windows-nvm tool that is not supported yet
@@DevLeonardo I'm so sorry for the late reply. No, I'm on Ubuntu 22.04.3 LTS.
@@DevLeonardo Ok, it only works in one direction. When I cd into my project dir, it changes the node version. But, when I go out from the dir it doesn't change it back.
@@DevLeonardo Wait, do I need to have .nvmrc file in my $HOME as well?
@@DevLeonardo Yep, it worked. Sorry for stupid questions bro. And, thank you.
If you're using nvm, how many node versions do you have currently installed? I have... watch the video to know :P
You can count them with: nvm ls node | wc -l
date una medaglia a quest'uomo!
🎖️