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
  • НаукаНаука

Комментарии • 21

  • @Akshaykumar11
    @Akshaykumar11 Год назад +1

    That's a very informative video on Multiple Node Versions with nvm, thanks Leonardo for this ✨

    • @DevLeonardo
      @DevLeonardo  Год назад

      Thank you, glad to hear that! :D

  • @dandisetiyawan80
    @dandisetiyawan80 Год назад +1

    very useful, thanks!

    • @DevLeonardo
      @DevLeonardo  Год назад

      Thank you! And welcome to my channel :D

  • @mkkavinda7016
    @mkkavinda7016 Месяц назад

    hey, whats the vscode extension that u're using for suggestions in terminal?

  • @Steve-Richter
    @Steve-Richter 3 месяца назад

    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.

  • @dinoscheidt
    @dinoscheidt Год назад +1

    Suggest NVS (Node Version Switcher) - much easier to use (i.e. for junior engineers) very well maintained

    • @DevLeonardo
      @DevLeonardo  Год назад

      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!

  • @authenticadel
    @authenticadel Год назад +1

    what about the script in windows is it the same to automatically switch ???

    • @DevLeonardo
      @DevLeonardo  Год назад +1

      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 :)

  • @aadil4236
    @aadil4236 10 месяцев назад +1

    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.

    • @DevLeonardo
      @DevLeonardo  10 месяцев назад

      Heyhey! Are you on Windows? If I'm not mistaken on the windows-nvm tool that is not supported yet

    • @aadil4236
      @aadil4236 9 месяцев назад

      @@DevLeonardo I'm so sorry for the late reply. No, I'm on Ubuntu 22.04.3 LTS.

    • @aadil4236
      @aadil4236 9 месяцев назад

      @@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.

    • @aadil4236
      @aadil4236 9 месяцев назад

      @@DevLeonardo Wait, do I need to have .nvmrc file in my $HOME as well?

    • @aadil4236
      @aadil4236 9 месяцев назад

      @@DevLeonardo Yep, it worked. Sorry for stupid questions bro. And, thank you.

  • @DevLeonardo
    @DevLeonardo  Год назад

    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

  • @emanuelegurini
    @emanuelegurini Год назад +1

    date una medaglia a quest'uomo!