This content originally appeared on DEV Community and was authored by Sonu Kumar
Introduction
Managing multiple versions of Node.js on your Ubuntu system is crucial for development. Node Version Manager (NVM) simplifies this process, allowing you to switch between different versions effortlessly.
Step-by-Step Installation
- Update Your System:
sudo apt update
- Install Curl:
sudo apt install curl
- Download and Install NVM:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
- Activate NVM:
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
- Verify NVM Installation:
nvm --version
- Install Node.js Using NVM:
nvm install node
- Set Default Node.js Version:
nvm alias default node
- Check Installed Node.js Version:
node --version
Managing Node.js Versions
- Install Specific Version:
nvm install <version>
- Switch Node.js Version:
nvm use <version>
- List Installed Versions:
nvm ls
- Uninstall Node.js Version:
nvm uninstall <version>
Conclusion
Using NVM on Ubuntu provides flexibility and control over your Node.js environment, making development smoother and more efficient.
To know how to install the NVM on Windows please have a look:
How to install NVM(Node Version Manager) on Windows
To learn about the Docker basics please have a look:
What is Docker and why do we use it?
This content originally appeared on DEV Community and was authored by Sonu Kumar
Sonu Kumar | Sciencx (2024-06-26T12:13:47+00:00) Simplified Guide to Installing NVM on Ubuntu. Retrieved from https://www.scien.cx/2024/06/26/simplified-guide-to-installing-nvm-on-ubuntu/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.