Home >Web Front-end >JS Tutorial >Install/Use Any Version of Node.js with nvm (Node Version Manager)

Install/Use Any Version of Node.js with nvm (Node Version Manager)

Susan Sarandon
Susan SarandonOriginal
2024-11-16 07:43:02514browse

Managing multiple versions of Node.js can be frustrating if you don’t have a quick way to install the needed version, especially across different OS platforms.

Thankfully, nvm (Node Version Manager) supports Unix, MacOS, and WSL for managing Node.js versions efficiently.

Initially, I thought of writing a lot, but here has everything you need and more ??

Install/Use Any Version of Node.js with nvm (Node Version Manager)

Run this command in the terminal:

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

Or

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

Then, run:

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

Done. Now, use nvm install node to install the latest version or nvm ls to view available Node.js versions.

Cover photo by Lautaro Andreani

The above is the detailed content of Install/Use Any Version of Node.js with nvm (Node Version Manager). For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn