Switch Node.js versions from VS Code with nvm, nvm-windows, fnm, pnpm, Volta, mise, or Vite+ (vp).
- View installed versions and install new versions from the command palette or status bar, supporting both global and project scopes.
- Supports tool declarations such as mise.toml, .tool-versions, .nvmrc, .node-version, etc.
- Select based on project configuration and current Node; if the situation is unclear, you can choose manually and remember the choice for each workspace.
- Install and initialize one of the supported Node managers.
- Open your project in VS Code.
- Click the Node version in the status bar, choose an installed version, then select global or project scope. You can also install a new version. If a manager needs to be selected first, the version list opens immediately after that selection.
- Click the separate manager name / choose manager status item to change managers. Run Node: Show Current Version to inspect the version, path, and manager.
| Manager | Global | Project |
|---|---|---|
| nvm (macOS/Linux) | Set the default | Write .nvmrc |
| nvm-windows | Switch the global version | Not supported |
| fnm | Set the default | Write .node-version |
| Volta | Set the default | Pin in package.json |
| mise | Set the global version | Write mise project configuration |
| pnpm | Set the global Node version | Not available |
| Vite+ (vp) | Set the default | Pin the project version |
| Command | Description |
|---|---|
| Node: Switch Version | Browse and switch installed Node versions |
| Node: Select Version Manager | Choose and remember the manager for this workspace |
| Node: Install Version | Install a Node version |
| Node: Show Current Version | Show the Node version, path, and manager seen by VS Code |
| Node: Refresh Versions | Rescan managers, versions, and project configuration |
| Node: Show Diagnostics | Inspect manager detection, runtime, and project declarations |
在 VS Code 中查看并切换 Node.js 版本。
- 从命令面板或状态栏查看已安装版本、安装新版本,支持全局和项目范围。
- 支持 mise.toml、.tool-versions、.nvmrc、.node-version等工具声明。
- 根据项目配置和当前 Node 选择;情况不明时可手动选择,并为各工作区记住选择。
- 安装并初始化至少一个支持的 Node 管理器。
- 在 VS Code 中打开项目。
- 点击状态栏的 Node 版本,选择已安装版本,再选择全局或项目范围;也可以选择“安装新版本”。如果尚未确定管理器,会先让你选择管理器,随后直接显示版本列表。
- 状态栏旁边的 管理器名称 / 选择管理器 用于更换管理器。运行 Node:显示当前版本 可查看版本、路径和管理器。
首次发现项目 Node 版本要求时,扩展会询问是否准备所需运行时。准备运行时不会改写项目原有的版本声明。
| 文件或字段 | 说明 |
|---|---|
| mise.toml、.mise.toml | 识别 Node 配置,优先选择 mise |
| mise.local.toml、.mise.local.toml、.tool-versions | 读取 mise 或通用版本声明 |
| .nvmrc、.node-version | 读取版本;文件本身不能判断使用哪个管理器 |
| package.json → volta.node | 识别 Volta 项目版本 |
| package.json → devEngines.runtime、engines.node | 读取项目 Node 版本要求 |
如果项目配置之间的版本要求冲突,扩展会显示冲突来源并让你选择。
| 管理器 | 全局 | 项目 |
|---|---|---|
| nvm(macOS/Linux) | 设置默认版本 | 写入 .nvmrc |
| nvm-windows | 切换全局版本 | 不支持 |
| fnm | 设置默认版本 | 写入 .node-version |
| Volta | 设置默认版本 | 固定到 package.json |
| mise | 设置全局版本 | 写入 mise 项目配置 |
| pnpm | 设置全局 Node 版本 | 暂不提供 |
| Vite+(vp) | 设置默认版本 | 固定项目版本 |
项目作用范围使用管理器原生配置;自动准备运行时时保留现有声明。
| 命令 | 用途 |
|---|---|
| Node:切换版本 | 查看并切换已安装版本 |
| Node:选择版本管理器 | 选择并记住本工作区使用的管理器 |
| Node:安装版本 | 安装 Node 版本 |
| Node:显示当前版本 | 查看 VS Code 当前 Node 版本、路径和管理器 |
| Node:刷新版本 | 重新扫描管理器、版本和项目配置 |
| Node:显示诊断信息 | 查看检测结果、运行时和项目配置 |
Apache-2.0