nodejs 版本管理

发布时间: 更新时间: 总字数:177 阅读时间:1m 作者: 分享 复制网址
专栏文章
  1. nodejs 版本管理(当前)
  2. NPM Registry Proxy 配置
  3. npm 常用命令
  4. Node.js 介绍
  5. 使用 forever 运行 nodejs 应用

python 我们使用 env 来管理不同版本之间的切换。nodejs 是否有类似的切换版本的方法哪?本文提供一种在 mac 上快速切换 nodejs 版本的方法。

n

npm i -g n
sudo n v11
node --version

nvm

nvm(Node Version Manager) node 版本管理工具

安装

  • Linux
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
  • windows

https://github.com/coreybutler/nvm-windows/releases

使用

source ~/.bashrc
# 查看支持的版本,访问 https://nodejs.org/dist/index.json 获取的列表
nvm list available

#安装
nvm install 12

# 切换
nvm use 16

其他

类似的工具:

  • volta 无忧无虑的JavaScript工具管理器
# install Volta
curl https://get.volta.sh | bash

# install Node
volta install node

volta install node@16

# start using Node
node
Home Archives Categories Tags Statistics
本文总阅读量 次 本站总访问量 次 本站总访客数