# 配置远程 Node.js 运行时

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

> **TL;DR**
> 必需插件  :
>
>
>
> `JavaScript 和 TypeScript` ，  `JavaScript Debugger`  -  插件已与 GoLand 捆绑并默认启用。
>
>
>
> `Node.js`  和  `Node.js Remote Interpreter`  - 在   设置 | 插件   页面上安装插件。

在 GoLand 中，当您希望在安装于远程主机或虚拟环境中的 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 运行时，GoLand 会建议下载它。 选择所需的运行时版本及其安装位置。

![在远程环境中安装 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. 安装  Node.js  和  Node.js 远程解释器  插件（在   设置 | 插件   页面上），如 [从 JetBrains Marketplace 安装插件](managing-plugins.html#install_plugin_from_repo) 中所述。 。.

2. 请在设置中确保启用了  FTP/SFTP/WebDAV Connectivity  插件。 按下 `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+Comma` (VSCode), `⌘ Comma` (VSCode (macOS)) 打开设置，然后选择  `插件` 。 在搜索字段中，输入  FTP/SFTP/WebDAV Connectivity 。 有关插件的更多信息，请参阅 [管理插件](managing-plugins.html)。

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+Comma` (VSCode), `⌘ Comma` (VSCode (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 配置。

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

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

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

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

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

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

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 运行时](node-js-interpreters.html) 对话框。

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

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

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

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

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+Comma` (VSCode), `⌘ Comma` (VSCode (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  配置文件所在的文件夹。 基于此设置，GoLand 检测到  Vagrant host  并将其作为链接显示在   Vagrant 主机 URL   只读字段中。

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

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

要定位 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+`` (VSCode), `⌃ `` (VSCode (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. 单击   确定   返回到   Node.js 运行时   对话框，其中已将新运行时添加到列表。

8. 要将新配置的运行时设置为项目默认，请在列表中选择它并点击   确定   返回到   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 运行时  列表中选择  `项目` 别名时，GoLand都会自动使用此解释器，例如在创建运行/调试配置时。

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+`` (VSCode), `⌃ `` (VSCode (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)。

