How to install NVM (Node Version Manager) in Garuda linux or Arch Linux based

How to install NVM (Node Version Manager) in Garuda linux or Arch Linux based

trusted article about how to install nvm in garuda linux or arch linux

Here are the steps to install NVM in Garuda Linux:

1. Check your default shell:

  • Open a terminal and run echo $SHELL to determine your current shell.

  • If it's not Bash or Zsh, you'll need to switch to one of them for NVM to work properly. You can change your default shell using Garuda's settings or by editing your ~/.profile file.

2. Install NVM:

  • Choose one of the following methods:

    • Using the Arch User Repository (AUR):

      • Run yay -S nvm to install NVM from the AUR.
    • Manual installation:

      • Run the following command in your terminal: Bash

          curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
        

3. Activate NVM in your current session:

  • Run source ~/.bashrc (or source ~/.zshrc if you're using Zsh).

4. Verify installation:

  • Run nvm --version to check if NVM is installed correctly.

5. Install Node.js versions:

  • Use NVM to install different Node.js versions: Bash

      nvm install <version>
    

    (e.g., nvm install 18.12.1)

6. Use different Node.js versions:

  • Switch between installed versions: Bash

      nvm use <version>
    
  • Check the currently used version: Bash

      nvm current
    

Additional notes:

  • Fish shell: If you prefer Fish shell, consider using fisher to manage plugins, as NVM doesn't have native Fish support.

  • PATH variable: Ensure the path to NVM's bin directory is included in your PATH environment variable.

  • Troubleshooting: If you encounter issues, refer to the NVM documentation (https://github.com/nvm-sh/nvm) for further guidance.

Did you find this article valuable?

Support The art of Code by becoming a sponsor. Any amount is appreciated!