# 配置远程 Node.js 运行时

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/zh-cn/help/idea/llms.txt).

> **TL;DR**
> 所需插件  :
>
>
>
> `JavaScript 和 TypeScript`  -  插件与 IntelliJ IDEA 捆绑在一起，并默认启用。
>
>
>
> `JavaScript Debugger` 、  `Node.js`  和  `Node.js Remote Interpreter`  -  在   设置 | 插件   页面上安装插件。 插件仅在具有 Ultimate 订阅的 IntelliJ IDEA 中可用。

在 IntelliJ IDEA 中，当您希望在安装于远程主机或虚拟环境中的 Node.js 上开发、测试、代码检查、运行和调试应用程序时，您需要配置远程 Node.js 运行时。

远程 Node.js 运行时在   配置 Node.js 远程运行时   对话框中进行配置。 您可以从   设置   对话框的 [JavaScript 运行时](javascript-runtime.html) 页面打开此对话框，或在稍后为在远程环境中运行或调试应用程序而创建或编辑 Node.js 运行/调试配置时打开。

建议的方式是在   设置   对话框中配置远程 Node.js 运行时。 在这种情况下，您可以将该运行时及其关联的包管理器设置为项目默认。

直接在 Node.js 运行/调试配置中配置的远程 Node.js 运行时只能与该运行/调试配置一起使用。

## 在远程环境中安装 Node.js

当您在未配置 Node.js 运行时的远程环境中打开需要 Node.js 的文件时，IntelliJ IDEA 会建议下载该运行时。 选择所需的运行时版本及其安装位置。

![在远程环境中安装 Node.js](https://resources.jetbrains.com/help/img/idea/2026.3/ws_node_install_node_js_in_remote_environment.png)

## 通过 SSH 连接可访问的主机上的远程 Node.js 运行时

Procedure: 开始之前

1. 请确保已在设置中启用  JavaScript 和 TypeScript  插件。 按 `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS))打开设置，然后选择  `插件` 。 在搜索字段中，键入  JavaScript 和 TypeScript 。 有关插件的更多信息，请参阅 [管理插件](managing-plugins.html)。

2. 安装  Node.js 、  Node.js 远程解释器  和  FTP/SFTP/WebDAV 连接  插件，位置在   设置 | 插件   页面上，如 [从 JetBrains Marketplace 安装插件](managing-plugins.html#install_plugin_from_repo) 中所述。 插件仅在具有 Ultimate 订阅的 IntelliJ IDEA 中可用。

3. 按照 [创建 SSH 配置](create-ssh-configurations.html) 中所述，在目标远程主机上配置对  SSH  服务器的访问权限，并确保此服务器正在运行。

通过 SSH 的 Node.js 运行时在   配置 Node.js 远程运行时   对话框中进行配置。 您可以从 [JavaScript 运行时](javascript-runtime.html) 页面（位于   设置   对话框中）打开此对话框，或者在稍后，当您 [创建或编辑 Node.js 运行/调试配置](#ws_node_configure_remote_interpreter_ssh_run_configuration) 以运行或调试您的应用程序时。

建议的方式是在   设置   对话框中配置远程 Node.js 运行时。 在这种情况下，您可以将该运行时及其关联的包管理器设置为项目默认。

直接在 Node.js 运行/调试配置中配置的远程 Node.js 运行时只能与该运行/调试配置一起使用。

Procedure: 在设置对话框中通过 SSH 配置远程 Node.js 运行时

1. 打开   设置   对话框（ `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS))），然后转到  `语言与框架 | JavaScript 运行时` 。

2. 点击 ![浏览按钮](https://resources.jetbrains.com/help/img/idea/2026.3/app.general.ellipsis.svg) 字段旁的   Node.js 运行时  。

![添加运行时 - 浏览按钮](https://resources.jetbrains.com/help/img/idea/2026.3/ws_node_interpreter_from_settings_browse_button.png)

3. 在包含所有当前已配置运行时列表的 [Node.js 运行时](node-js-interpreters.html) 对话框中，点击工具栏中的 !["添加"按钮](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.add.svg)，然后在上下文菜单中选择   添加远程   .

![通过 SSH 配置 Node.js 运行时：添加远程](https://resources.jetbrains.com/help/img/idea/2026.3/ws_node_interpreter_from_settings_docker_add_remote.png)

4. 在打开的 [配置 Node.js 远程运行时对话框](configure-node-js-remote-interpreter.html) 中，选择   SSH  。

5. 选择要使用的 SSH 配置。

![通过 SSH 配置远程 Node.js 运行时：选择 SSH 配置](https://resources.jetbrains.com/help/img/idea/2026.3/ws_configure_remote_node_interpreter_ssh_select_ssh_configuration.png)

或者，点击 ![浏览按钮](https://resources.jetbrains.com/help/img/idea/2026.3/app.general.ellipsis.svg)，并按照 [创建 SSH 配置](create-ssh-configurations.html) 中所述创建新的 SSH 配置。

6. 点击   OK   返回到   Node.js 运行时   对话框，其中已将新运行时添加到列表。

![远程运行时对话框：已将通过 SSH 的新 Node.js 运行时添加到列表中](https://resources.jetbrains.com/help/img/idea/2026.3/ws_node_node_configure_interpreter_remote_interpreters_dialog_ssh_node_added.png)

7. 要将新配置的运行时设置为项目默认，请在列表中选择它并点击   OK   以返回到   JavaScript 运行时   对话框。

每次您从   Node.js 运行时  列表中选择  `项目` 别名时，IntelliJ IDEA都会自动使用此解释器，例如在创建运行/调试配置时。

若要使用与新运行时关联的包管理器来管理项目依赖项，请将该包管理器设为项目默认。 要做到这一点，请在   包管理器  字段中指定包管理器的位置。

npm 可执行文件的默认位置是  `/usr/local/lib/node_modules/npm` 。

![通过 SSH 配置 Node.js 运行时：设置为默认项目解释器](https://resources.jetbrains.com/help/img/idea/2026.3/ws_node_interpreter_from_settings_ssh_default_project_interpreter_and_package_manager.png)

Procedure: 在运行/调试配置中通过 SSH 配置远程 Node.js 运行时

1. 前往  `运行 | 编辑配置` 。 在弹出的   编辑配置   对话框中，点击工具栏上的 ![添加新配置按钮](https://resources.jetbrains.com/help/img/idea/2026.3/调试配置：Node.js](run-debug-configuration-node-js.html)对话框打开。

2. 点击 ![浏览按钮](https://resources.jetbrains.com/help/img/idea/2026.3/app.general.ellipsis.svg)，位于   Node.js 运行时   字段旁边。

![Node.js 运行/调试配置：已指定文件](https://resources.jetbrains.com/help/img/idea/2026.3/ws_node_ssh_configure_interpreter_run_configuration_new.png)

将打开 [Node.js 运行时](node-js-interpreters.html) 对话框。

3. 点击工具栏上的 !["添加"按钮](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.add.svg)，然后从上下文菜单中选择   添加远程  。

![通过 SSH 的 Node.js：运行/调试配置、配置运行时、选择 添加远程](https://resources.jetbrains.com/help/img/idea/2026.3/ws_node_ssh_run_configuration_add_remote_new.png)

4. 通过 SSH 配置远程 Node.js 运行时， [如上所述](#ws_node_ssh_configure_remote_interpreter_preferences_remote_interpreters_dialog)。

## Docker 容器中的远程 Node.js 运行时

Procedure: 开始之前

1. 按照 [从 JetBrains Marketplace 安装插件](managing-plugins.html#install_plugin_from_repo)中所述，在   设置 | 插件  页面上安装并启用  Node.js 远程解释器 插件。

2. 请确保  Node.js  和  Docker  所需插件已在   设置 | 插件   页面上启用。 有关更多信息，请参阅 [管理插件](managing-plugins.html)。

3. 下载、安装并配置  Docker ，如 [Docker](docker.html) 中所述。

Docker 中的 Node.js 运行时在   配置 Node.js 远程运行时   对话框中进行配置。 您可以从 [JavaScript 运行时](javascript-runtime.html) 页面中的   设置   对话框打开此对话框，或者在稍后当您为了在 Docker 中运行或调试您的应用程序而 [创建或编辑 Node.js 运行/调试配置](#ws_node_configure-remote_interpreter_docker_run_configuration) 时打开。

建议的方式是在   设置   对话框中配置远程 Node.js 运行时。 在这种情况下，您可以将该运行时及其关联的包管理器设置为项目默认。 因此，您不仅可以使用在 Docker 中配置的 Node.js 运行时运行和调试应用，还可以管理项目依赖项、运行测试并执行代码检查。

直接在 Node.js 运行/调试配置中配置的远程 Node.js 运行时只能与该运行/调试配置一起使用。

Procedure: 在设置对话框中配置 Node.js 运行时

1. 前往  `运行 | 编辑配置` 。 在弹出的   编辑配置   对话框中，点击工具栏上的 ![添加新配置按钮](https://resources.jetbrains.com/help/img/idea/2026.3/调试配置：Node.js](run-debug-configuration-node-js.html)对话框中，点击 ![浏览按钮](https://resources.jetbrains.com/help/img/idea/2026.3/app.general.ellipsis.svg) 附近的   Node.js 运行时   字段。

2. 在包含所有当前已配置运行时列表的 [Node.js 运行时](node-js-interpreters.html) 对话框中，点击工具栏中的 !["添加"按钮](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.add.svg)，然后在上下文菜单中选择   添加远程   .

3. 在打开的 [配置 Node.js 远程运行时对话框](configure-node-js-remote-interpreter.html) 中，选择   Docker   选项。

1.

在   服务器  字段中，指定要使用的  Docker 配置 。 有关更多信息，请参阅 [配置 Docker 守护程序连接设置](docker.html#connect_to_docker)。 从列表中选择一个配置，或点击 ![浏览按钮](https://resources.jetbrains.com/help/img/idea/2026.3/app.general.ellipsis.svg)并在打开的 [Docker 页面](settings-docker.html)上创建一个新配置。

2.  在   镜像名称  字段中，指定要使用的基础 Docker 镜像。 从列表中选择一个先前下载的或自定义的图像，或者手动输入图像名称，例如，  `node:argon` 或  `mhart/alpine-node` 。 当您稍后启动运行配置时，Docker 将在您的机器上搜索指定的镜像。 如果搜索失败，镜像将从 [Docker 官方镜像](https://hub.docker.com/_/node/) 仓库下载到 [Docker Registry 页面](settings-docker-registry.html)。

3.    Node.js 运行时路径   字段显示指定镜像中的默认 Node.js 解释器的位置。

4.  当您点击   OK   时，IntelliJ IDEA 会关闭   配置 Node.js 远程解释器   对话框，并将您带到 [Node.js 运行时](node-js-interpreters.html) 对话框，在其中会将新的运行时配置添加到列表中。 点击   OK   返回运行配置。

Procedure: 在 Node.js 运行/调试配置中配置 Node.js 运行时

1. 前往  `运行 | 编辑配置` 。 在弹出的   编辑配置   对话框中，点击工具栏上的 ![添加新配置按钮](https://resources.jetbrains.com/help/img/idea/2026.3/调试配置：Node.js](run-debug-configuration-node-js.html)对话框打开。

2. 点击 ![浏览按钮](https://resources.jetbrains.com/help/img/idea/2026.3/app.general.ellipsis.svg)，位于   Node.js 运行时   字段旁边。 将打开 [Node.js 运行时](node-js-interpreters.html) 对话框。

3. 点击工具栏上的 !["添加"按钮](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.add.svg)，然后从上下文菜单中选择   添加远程  。

![在 Docker 中的 Node.js：运行/调试配置，配置运行时，选择 添加远程](https://resources.jetbrains.com/help/img/idea/2026.3/ws_node_docker_run_configuration_add_remote.png)

4. 配置远程 Node.js 运行时， [如上所述](#ws_node_docker_configure_remote_interpreter_preferences_remote_interpreters_dialog)。

## 在带有 Docker Compose 定义的 Docker 容器中使用远程 Node.js 运行时

借助 [Docker Compose](https://docs.docker.com/compose/overview/)，您可以将 Node.js 服务器和您的应用程序代码作为单独的服务运行。 每个服务都可以通过添加更多的容器来扩展规模（如果需要的话）。 这使您能够在类似于生产环境的动态环境中进行高效的开发和测试。

Procedure: 开始之前

1. 按照 [从 JetBrains Marketplace 安装插件](managing-plugins.html#install_plugin_from_repo)中所述，在   设置 | 插件  页面上安装并启用  Node.js 远程解释器 插件。

2. 请确保  Node.js  和  Docker  所需插件已在   设置 | 插件   页面上启用。 有关更多信息，请参阅 [管理插件](managing-plugins.html)。

3. 下载、安装并配置  Docker ，如 [Docker](docker.html) 中所述。

多容器 Docker 应用程序中的 Node.js 运行时在   配置 Node.js 远程运行时   对话框中进行配置。 您可以从   设置   对话框的 [JavaScript 运行时](javascript-runtime.html) 页面打开此对话框，或在稍后为在 Vagrant 环境中运行或调试应用程序而 [创建或编辑 Node.js 运行/调试配置](null) 时打开。

建议的方式是在   设置   对话框中配置远程 Node.js 运行时。 在这种情况下，您可以将该运行时及其关联的包管理器设置为项目默认。 因此，您不仅可以使用在 Docker 中配置的 Node.js 运行时运行和调试应用，还可以管理项目依赖项、运行测试并执行代码检查。 请参阅 [npm、pnpm 和 yarn 与 Docker](node-with-docker.html#ws_node_docker_manage_dependencies)、 [测试您的应用程序](node-with-docker.html#ws_node_docker_test_app)和 [使用 Docker 的 ESLint](node-with-docker.html#ws_node_docker_lint)下文。

直接在 Node.js 运行/调试配置中配置的远程 Node.js 运行时只能与该运行/调试配置一起使用。

Procedure:

1. 打开   设置   对话框（ `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS))），然后转到  `语言与框架 | JavaScript 运行时` 。

2. 点击 ![浏览按钮](https://resources.jetbrains.com/help/img/idea/2026.3/app.general.ellipsis.svg) 字段旁的   Node.js 运行时  。

![添加运行时 - 浏览按钮](https://resources.jetbrains.com/help/img/idea/2026.3/ws_node_interpreter_from_settings_browse_button.png)

3. 在包含所有当前已配置运行时列表的 [Node.js 运行时](node-js-interpreters.html) 对话框中，点击工具栏中的 !["添加"按钮](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.add.svg)，然后在上下文菜单中选择   添加远程   .

![在 Docker 容器中配置 Node.js 运行时：添加远程](https://resources.jetbrains.com/help/img/idea/2026.3/ws_node_interpreter_from_settings_docker_add_remote.png)

4. 在打开的 [配置 Node.js 远程运行时对话框](configure-node-js-remote-interpreter.html) 中，选择   Docker Compose  。

5. 从   服务器   列表中，选择要使用的 Docker 配置。

![通过 Docker Compose 配置 Node.js 运行时：选择 Docker 服务器](https://resources.jetbrains.com/help/img/idea/2026.3/ws_node_interpreter_from_settings_docker_compose_docker_server.png)

或者，点击字段旁边的   新建   按照 [启用 Docker 支持](docker.html#connect_to_docker) 中的描述配置 Docker 服务器。

6. 在   配置文件  字段中，指定要使用的  `docker-compose` 配置文件。 点击   浏览  ，并在打开的   Docker Compose 配置文件   对话框中创建配置文件列表。

![通过 Docker Compose 配置 Node.js 运行时：配置文件](https://resources.jetbrains.com/help/img/idea/2026.3/ws_node_interpreter_from_settings_docker_compose_configuration_files.png)

7. 从   服务   列表中选择要使用的服务：

![通过 Docker Compose 配置 Node.js 运行时：选择服务](https://resources.jetbrains.com/help/img/idea/2026.3/ws_node_interpreter_from_settings_docker_compose_select_service.png)

8. 点击   OK   返回到   Node.js 运行时   对话框，其中已将新运行时添加到列表。 要将新配置的运行时设置为项目默认，请在列表中选择它并点击   OK   以返回到   JavaScript 运行时   对话框。

![远程运行时对话框：已将在 Docker 中的新 Node.js 运行时添加到列表中](https://resources.jetbrains.com/help/img/idea/2026.3/ws_node_configure_interpreter_docker_compose_added.png)

每次您从   Node.js 运行时  列表中选择  `项目` 别名时，IntelliJ IDEA都会自动使用此解释器，例如在创建运行/调试配置时。

若要使用与新运行时关联的包管理器来管理项目依赖项，请将该包管理器设为项目默认。 要做到这一点，请在   包管理器  字段中指定包管理器的位置。 详细了解，请参阅 [在项目中指定默认的 Node.js 运行时和包管理器](node-with-docker-compose.html#ws_node_docker_specify_default_project_interpreter_and_package_manager)。

### 在项目中指定默认的 Node.js 运行时和包管理器

每次从   Node.js 运行时   列表中选择  `项目`  别名时，IntelliJ IDEA 都会自动使用默认项目解释器，例如创建运行/调试配置时。

默认的项目包管理器会自动用于管理依赖项，例如，当您从  `<package manager> install`  文件运行  `package.json`  或安装第三方工具（例如 ESLint、Prettier 等）时。

Procedure:

1. 打开   设置   对话框（ `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS))），然后转到  `语言与框架 | JavaScript 运行时` 。

2. 确保在   首选运行时   列表中选中   Node.js  。

![选择首选运行时](https://resources.jetbrains.com/help/img/idea/2026.3/ws_node_docker_specify_default_project_interpreter_and_package_manager_steps_select_preferred_runtime.png)

3. 从   Node.js 运行时   列表中选择要在当前项目中默认使用的配置。

![选择默认 Node.js 配置](https://resources.jetbrains.com/help/img/idea/2026.3/ws_node_docker_specify_default_project_interpreter_and_package_manager_steps_select_default_runtime.png)

4. 从   包管理器  列表中选择与要使用的软件包管理器相关联的别名。 IntelliJ IDEA 会自动检测其位置。

![设置：已将新配置的远程 Node.js 运行时选为默认](https://resources.jetbrains.com/help/img/idea/2026.3/ws_node_interpreter_from_settings_docker_compose_default_project_interpreter_and_package_manager_detected.png)

或者，手动指定所需包管理器的位置。

* npm 可执行文件的默认位置是 `/usr/local/lib/node_modules/npm` 。

* 默认情况下，pnpm 的位置取决于安装方法： 1. 通过 `/usr/local/lib/node_modules/pnpm` 安装。 2. `/usr/local/pnpm-global/<version>/node_modules/pnpm` 用于通过 curl 安装（ `curl -f https://get.pnpm.io/<version>.js | node - add --global pnpm` ）。 进一步了解请访问 [pnpm official website](https://pnpm.io/installation)。

* yarn 的默认位置是 `/opt/yarn-<version>5` ，例如， `/opt/yarn-v1.22.5` 。

### 在 Node.js 运行/调试配置中使用 Docker Compose 定义配置 Node.js 运行时

Procedure:

1. 前往  `运行 | 编辑配置` 。 在弹出的   编辑配置   对话框中，点击工具栏上的 ![添加新配置按钮](https://resources.jetbrains.com/help/img/idea/2026.3/调试配置：Node.js](run-debug-configuration-node-js.html)对话框打开。

2. 在   文件   字段中，指定启动应用程序的主文件路径（例如，  `bin/www`  对于 [Express](http://expressjs.com/) 应用程序）。

![Node.js 运行/调试配置：指定的 JavaScript 文件](https://resources.jetbrains.com/help/img/idea/2026.3/ws_node_docker_compose_run_configuration_js_file_specified.png)

3. 如有必要，请按照 [运行和调试 Node.js 应用程序](running-and-debugging-node-js.html#ws_node_run_config_optionally)中描述的方式指定一些可选设置。

4. 从   Node.js 运行时   列表中，选择通过 Docker Compose 的相应远程 Node.js 运行时。

![使用 Docker Compose 的 Node.js：运行/调试配置，选择解释器](https://resources.jetbrains.com/help/img/idea/2026.3/ws_node_docker_compose_run_configuration_select_interpreter.png)

或者，点击 ![浏览按钮](https://resources.jetbrains.com/help/img/idea/2026.3/app.general.ellipsis.svg)，位于   Node.js 运行时   字段旁边 。 并按照 [如上所述](node-with-docker-compose.html#ws_node_docker_compose_configure_interpreter) 配置远程 Node.js 运行时。

![在 Docker 中的 Node.js：运行/调试配置，配置运行时，选择 添加远程](https://resources.jetbrains.com/help/img/idea/2026.3/ws_node_docker_compose_run_configuration_add_remote.png)

5. 在   Docker Compose   区域中，指定要传递给 Docker Compose 的命令和选项。 接受默认设置或点击 ![“展开”按钮](https://resources.jetbrains.com/help/img/idea/2026.3/app.general.expandComponent.svg)并指定自定义设置，例如，自定义 Docker Compose 标志，像  `--rm` 或  `--service-ports` 。 了解更多信息请访问 [Docker 官方网站](https://docs.docker.com/compose/reference/)。

请检查   命令预览  。

![Docker Compose 区域预览](https://resources.jetbrains.com/help/img/idea/2026.3/ws_node_docker_compose_run_configuration_docker_compose_area.png)

## Vagrant 实例中的 Node.js 运行时

使用 [Vagrant](https://www.vagrantup.com/)，您可以快速引导您的 Node.js 应用程序来运行、调试和分析它的性能，从 IntelliJ IDEA 开始。

Procedure: 开始之前

1. 安装  Node.js 、  Node.js 远程解释器  和  Vagrant  插件，位置在   设置 | 插件   页面上，如 [从 JetBrains Marketplace 安装插件](managing-plugins.html#install_plugin_from_repo) 中所述。

2. 请确保已在您的计算机上下载、安装并配置好 [Vagrant](https://www.vagrantup.com/downloads) 和 [Oracle's VirtualBox](https://www.virtualbox.org/)。 有关更多信息，请参阅 [Vagrant](vagrant-support.html)。

3. 请确保以下可执行文件的父文件夹已添加到系统  PATH 变量：

* `vagrant.bat` 或 `vagrant` ，来自 Vagrant 安装。 这应该由 Vagrant 安装程序自动完成。

* `VBoxManage.exe` 或 `VBoxManage` ，来自 Oracle 的 VirtualBox 安装。

Vagrant 环境中的 Node.js 运行时在   配置 Node.js 远程运行时   对话框中进行配置。 您可以从   设置   对话框的 [JavaScript 运行时](javascript-runtime.html) 页面打开此对话框，或在稍后为在 Vagrant 环境中运行或调试应用程序而 [创建或编辑 Node.js 运行/调试配置](null) 时打开。

建议的方式是在   设置   对话框中配置远程 Node.js 运行时。 在这种情况下，您可以将该运行时及其关联的包管理器设置为项目默认。

直接在 Node.js 运行/调试配置中配置的远程 Node.js 运行时只能与该运行/调试配置一起使用。

Procedure: 在设置对话框中配置 Node.js 运行时

1. 打开   设置   对话框（ `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS))），然后转到  `语言与框架 | JavaScript 运行时` 。

2. 点击 ![浏览按钮](https://resources.jetbrains.com/help/img/idea/2026.3/app.general.ellipsis.svg) 字段旁的   Node.js 运行时  。

![添加运行时 - 浏览按钮](https://resources.jetbrains.com/help/img/idea/2026.3/ws_node_interpreter_from_settings_browse_button.png)

3. 在包含所有当前已配置运行时列表的 [Node.js 运行时](node-js-interpreters.html) 对话框中，点击工具栏中的 !["添加"按钮](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.add.svg)，然后在上下文菜单中选择   添加远程   .

![在 Vagrant 实例中配置 Node.js 远程运行时：添加远程](https://resources.jetbrains.com/help/img/idea/2026.3/ws_node_interpreter_from_settings_docker_add_remote.png)

4. 在打开的 [配置 Node.js 远程运行时对话框](configure-node-js-remote-interpreter.html) 中，选择   Vagrant  。

5. 请指定   Vagrant 实例文件夹  ，该变量指向您将要使用的环境。

从技术上讲，这是所需环境的  VagrantFile  配置文件所在的文件夹。 基于此设置，IntelliJ IDEA 会检测  Vagrant 主机 ，并将其作为链接显示在   Vagrant 主机 URL   只读字段中。

默认情况下，该字段显示当前项目文件夹。

6. 在   Node.js 运行时路径  字段中，指定 Node.js 可执行文件的位置。

![在 Vagrant 环境中配置远程 Node.js 运行时：指定实例文件夹和 Node 可执行文件的位置](https://resources.jetbrains.com/help/img/idea/2026.3/ws_node_interpreter_from_settings_vagrant.png)

要定位 Node.js 可执行文件，请打开命令行 shell 或嵌入的   终端  （ `Alt+F12` (Windows), `⌥ F12` (macOS), `⌥ F12` (IntelliJ IDEA Classic (macOS)), `⌘ ⌃ T` (macOS System Shortcuts), `Alt+F12` (XWin), `Alt+F12` (GNOME), `Alt+F12` (KDE), `Alt+F12` (Emacs), `Alt+F12` (Sublime Text), `⌥ F12` (Sublime Text (macOS)), `Ctrl+Alt+1` (Visual Studio), `⌘ ⌃ 1` (Visual Studio (macOS)), `Alt+F12` (NetBeans), `Alt+F12` (Eclipse), `⌥ F12` (Eclipse (macOS))）并输入：

```
vagrant ssh
whereis node
exit

```

![在 Vagrant 环境中定位 Node.js 可执行文件](https://resources.jetbrains.com/help/img/idea/2026.3/ws_node_vagrant_init_node_location.png)

7. 点击   OK   返回到   Node.js 运行时   对话框，其中已将新运行时添加到列表。

8. 要将新配置的运行时设置为项目默认，请在列表中选择它并点击   OK   以返回到   JavaScript 运行时   对话框。

![远程运行时对话框：已将在 Vagrant 环境中的新 Node.js 运行时添加到列表中](https://resources.jetbrains.com/help/img/idea/2026.3/ws_node_vagrant_configure_interpreter_run_configuration_remote_interpreters_dialog_vagrant_node_added.png)

每次您从   Node.js 运行时  列表中选择  `项目` 别名时，IntelliJ IDEA都会自动使用此解释器，例如在创建运行/调试配置时。

9. 指定要使用的软件包管理器路径。

![配置远程 Node.js 运行时：已指定包管理器](https://resources.jetbrains.com/help/img/idea/2026.3/ws_node_interpreter_from_settings_vagrant_package_manage_specified.png)

要定位软件包管理器，请打开命令行 shell 或嵌入的   终端  （ `Alt+F12` (Windows), `⌥ F12` (macOS), `⌥ F12` (IntelliJ IDEA Classic (macOS)), `⌘ ⌃ T` (macOS System Shortcuts), `Alt+F12` (XWin), `Alt+F12` (GNOME), `Alt+F12` (KDE), `Alt+F12` (Emacs), `Alt+F12` (Sublime Text), `⌥ F12` (Sublime Text (macOS)), `Ctrl+Alt+1` (Visual Studio), `⌘ ⌃ 1` (Visual Studio (macOS)), `Alt+F12` (NetBeans), `Alt+F12` (Eclipse), `⌥ F12` (Eclipse (macOS))）并输入：

```
vagrant ssh
whereis <package manager>
exit

```

![在 Vagrant 环境中定位软件包管理器](https://resources.jetbrains.com/help/img/idea/2026.3/ws_node_vagrant_npm_location.png)

Procedure: 在 Node.js 运行/调试配置中配置 Node.js 运行时

1. 前往  `运行 | 编辑配置` 。 在弹出的   编辑配置   对话框中，点击工具栏上的 ![添加新配置按钮](https://resources.jetbrains.com/help/img/idea/2026.3/调试配置：Node.js](run-debug-configuration-node-js.html)对话框打开。

2. 点击 ![浏览按钮](https://resources.jetbrains.com/help/img/idea/2026.3/app.general.ellipsis.svg)，位于   Node.js 运行时   字段旁边。 将打开 [Node.js 运行时](node-js-interpreters.html) 对话框。

3. 点击工具栏上的 !["添加"按钮](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.add.svg)，然后从上下文菜单中选择   添加远程  。

4. 在 Vagrant 环境中配置远程 Node.js 运行时， [如上所述](#ws_node_vagrant_configure_remote_interpreter_preferences_remote_interpreters_dialog)。

## See also

### 过程

[Node.js](developing-node-js-applications.html) [Vagrant](vagrant-support.html)

### 语言和框架特定指南

[将文件部署到服务器](deploying-applications.html)

### 参考

[Node.js 运行时对话框](node-js-interpreters.html) [部署](settings-deployment.html)

