Home>Article>Web Front-end> How does Node.js perform version management? 3 practical version management tools to share
NodeHow to perform version management? The following article will share with you 3 very practical Node.js version management tools. I hope it will be helpful to you!
In the previous article "What are the differences between various versions of Node.js? How to choose the right version?" introduced that Node.js versions are divided into LTS and Current series. When we need to install both the LTS version and the Current version in the local development environment, we need to perform version management on the Node.js version.
For example, Node.js 8.0.0 and Node.js 17.0.0 need to be installed locally.
In order to be able to version manage theNode.jsversion, I have compiled 3 very practical Node.js version management tools, allowing everyone to freely switch to Node in different local environments. js version.
⭐Github stars: 60K
nvmis a Node. js version management tool, allowing users to quickly install, switch and manage different Node.js versions through the command line.
Image from:github
nvm is only a project for macOS and Linux users, if you are a Windows user, you can use# Replace with ##nvm-windows,nodistornvs.
# 方式1 浏览器打开下面链接下载 https://github.com/nvm-sh/nvm/blob/v0.39.1/install.sh # 下载完成后,通过命令安装 sh install.sh # 方式2 推荐 curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash # 方式3 wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bashIf you encounter some strange problems during the installation process, you can check the
nvm supplement illustrate.
nvm ls # 查看版本安装所有版本 nvm ls-remote # 查看远程所有的 Node.js 版本 nvm install 17.0.0 # 安装指定的 Node.js 版本 nvm use 17.0.0 # 使用指定的 Node.js 版本 nvm alias default 17.0.0 # 设置默认 Node.js 版本 nvm alias dev 17.0.0 # 设置指定版本的别名,如将 17.0.0 版本别名设置为 dev
Github stars: 16.7K
#n Only available on macOS and Linux, not Windows.npm install n -g
n # 显示所有已下载版本 n 10.16.0 # 下载指定版本 n lts # 查看远程所有 LTS Node.js 版本 n run 10.16.0 # 运行指定的 Node.js 版本
n -hto view the help information. The main commands are as follows:
n Display downloaded Node.js versions and install selection n latest Install the latest Node.js release (downloading if necessary) n lts Install the latest LTS Node.js release (downloading if necessary) nInstall Node.js (downloading if necessary) n install Install Node.js (downloading if necessary) n run [args ...] Execute downloaded Node.js with [args ...] n which Output path for downloaded node n exec [args...] Execute command with modified PATH, so downloaded node and npm first n rm Remove the given downloaded version(s) n prune Remove all downloaded versions except the installed version n --latest Output the latest Node.js version available n --lts Output the latest LTS Node.js version available n ls Output downloaded versions n ls-remote [version] Output matching versions available for download n uninstall Remove the installed Node.js
Github stars: 8.4K
fnmis a fast and simple Node.js version manager, built using Rust.
Image from: Main features include:and
.nvmrcfiles;
# bash, zsh and fish shells curl -fsSL https://fnm.vercel.app/install | bashWindows environment:
# 管理员模式打开终端,安装后只能使用管理员模式打开使用 choco install fnm # 安装完成还需要手动设置环境变量Linux/macOS/Windows environment can also directly download the binary file for installation, download address:
fnm -h # 查看帮助 fnm install 17.0.0 # 安装指定 Node.js 版本 fnm use 17.0.0 # 使用指定 Node.js 版本 fnm default 17.0.0 # 设置默认 Node.js 版本
For more node-related knowledge, please visit:nodejs tutorial!
The above is the detailed content of How does Node.js perform version management? 3 practical version management tools to share. For more information, please follow other related articles on the PHP Chinese website!