How To Install NVM on Manjaro
In this tutorial, we will show you how to install NVM on Manjaro. Node Version Manager (NVM) is a tool that allows developers to install and manage multiple versions of Node.js. It is especially useful for testing applications across different Node.js versions.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of the NVM (Node Version Manager) on a Manjaro Linux.
Prerequisites
- A server or desktop running one of the following operating systems: Manjaro, and other Arch-based distributions.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- A stable internet connection is crucial for downloading and installing packages. Verify your connection before proceeding.
- Access to a Manjaro Linux system with a non-root sudo user or root user.
Install NVM on Manjaro
Step 1. Before installing any new software, it’s a good practice to update your package database. This ensures that you’re installing the latest version of the software and that all dependencies are up to date. To update the package database, run the following command in the terminal:
sudo pacman -Syu
Step 2. Installing NVM (Node Version Manager) on Manjaro.
To install NVM, you will use the curl
command to download the installation script from the official NVM GitHub repository:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
This command fetches the installation script and executes it. The script clones the NVM repository to ~/.nvm
and adds the necessary lines to your shell profile file to initialize NVM.
Step 3. Configuring NVM.
After the installation script has run, you need to add the NVM configuration to your profile file. The profile file is a script that is executed when a new shell session is started. By adding the NVM configuration to this file, you ensure that NVM is available every time you open a new terminal session:
echo 'source /usr/share/nvm/init-nvm.sh' >> ~/.bashrc
This command appends the NVM initialization script to your .bashrc
file, which is one of the profile files used by Bash, the default shell in many Linux distributions.
To confirm that NVM is installed correctly, open a new terminal or source your profile file, then run:
nvm --version
Step 4. Installing Node.js Using NVM.
With NVM installed, you can now install Node.js versions as needed. To see the list of available Node.js versions, use:
nvm ls-remote
To install a specific version of Node.js, run:
nvm install <version>
Replace <version>
with the desired Node.js version number.
After installing Node.js, you can verify the installation by checking the version:
node --version
Congratulations! You have successfully installed NVM. Thanks for using this tutorial to install the latest version of NVM (Node Version Manager) on the Manjaro system. For additional help or useful information, we recommend you check the official NVM website.