# 运行/调试配置：NW.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`  -  在   设置 | 插件   页面上安装插件。

创建：  `运行 | 编辑配置 |`  ![添加新配置](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.add.svg)  `| NW.js`

在此对话框中，创建用于运行 [NW.js](https://nwjs.io/) 应用程序和调试其  main  进程的配置。

若要调试后台和其他  main 进程，请使用 [Attach to Node.js/Chrome run/debug configuration](run-debug-configuration-node-js-remote-debug.html)，具体操作请参见 [Debugging a running Node.js application](running-and-debugging-node-js.html#node_debugging_running_application)。

## 在开始之前

Procedure:

1. 安装 [NW.js](https://nwjs.io/)。 如果您要调试应用程序，请确保使用 NW.js 的 [SDK 构建](https://nwjs.io/downloads/)。

2. 在  `设置 | 插件`  中安装 Node.js 插件，如 [从 JetBrains Marketplace 安装插件](managing-plugins.html#install_plugin_from_repo) 中所述。

## NW.js 特定配置设置

|  项目  |  描述  |
| --- | --- |
|  NW.js 应用  |  在此字段中，指定要启动的应用程序。 您可以选择包含  `package.json` 文件的整个目录或打包成带有  `.nw` 扩展名的存档的相同目录。  |
|  NW.js 参数  |  在此字段中，指定要传递给 [NW.js](https://nwjs.io/) 的参数。 如果必要，请点击 ![展开](https://resources.jetbrains.com/help/img/idea/2026.3/app.general.expandComponent.svg)并在打开的文本编辑器中输入参数。  |
|  工作目录  |     在此字段中，指定应用程序的工作目录。 默认情况下，   工作目录   字段显示项目根文件夹。 若要更改此预定义设置，请指定所需文件夹的路径。     |
|  环境变量  |  在此字段中，指定可执行文件的 [environment variables](http://en.wikipedia.org/wiki/Environment_variable)，如果适用。  |
|  NW.js 解释器  |  请指定 NW.js 可执行文件的路径。  |

## 通用设置

当您编辑运行配置（而不是运行配置模板）时，您可以指定以下选项：

|  项目  |  描述  |
| --- | --- |
|    名称    |  为运行配置指定一个名称，以便在编辑或运行时能快速识别。  |
|    存储为项目文件    |     将运行配置设置保存到文件中，以便与其他团队成员共享。 默认位置是  `.idea/runConfigurations` 。 但是，如果您不想共享  `.idea` 目录，您可以将配置保存到项目中的任何其他目录。       默认情况下，它是禁用的，并且 GoLand 将运行配置设置存储在  `.idea/workspace.xml` 。     |

## 工具栏

运行/调试配置的树状视图具有一个工具栏，可帮助您管理 项目 中可用的配置，并调整默认配置模板。

|  项目  |  快捷方式  |  描述  |
| --- | --- | --- |
|  ![添加按钮](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.add.svg)  |  `Alt+Insert` (Windows), `⌘ N` (macOS), `⌃ N` (IntelliJ IDEA Classic (macOS)), `⌘ N` (macOS System Shortcuts), `Alt+Insert` (XWin), `Alt+Insert` (GNOME), `Alt+Insert` (KDE), `Alt+Insert` (Emacs), `Ctrl+N` (Sublime Text), `⌘ N` (Sublime Text (macOS)), `Alt+Insert` (VSCode), `⌃ ⏎` (VSCode (macOS))  |  创建运行/调试配置。  |
|  !["移除"按钮](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.remove.svg)  |  `Alt+Delete` (Windows), `⌘ ⌦` (macOS), `⌘ ⌦` (IntelliJ IDEA Classic (macOS)), `⌘ ⌦` (macOS System Shortcuts), `Alt+Delete` (XWin), `Alt+Delete` (GNOME), `Alt+Delete` (KDE), `Alt+Delete` (Emacs), `Alt+Delete` (Sublime Text), `⌘ ⌦` (Sublime Text (macOS)), `Alt+Delete` (VSCode), `Alt+Delete` (VSCode (macOS))  |  删除选定的运行/调试配置。 请注意，您无法删除默认配置。  |
|  ![复制](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.copy.svg)  |  `Ctrl+D` (Windows), `⌘ D` (macOS), `⌘ D` (IntelliJ IDEA Classic (macOS)), `⌘ D` (macOS System Shortcuts), `Ctrl+D` (XWin), `Ctrl+D` (GNOME), `Ctrl+D` (KDE), `Meta+D` (Emacs), `Ctrl+Shift+D` (Sublime Text), `⌘ ⇧ D` (Sublime Text (macOS)), `Ctrl+D` (VSCode), `Ctrl+D` (VSCode (macOS))  |  创建选定运行/调试配置的副本。 请注意，您正在创建默认配置的副本。  |
|  ![保存配置](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.save.svg)  |  |  仅当您选择一个 [临时配置](null)时才会显示该按钮。 点击此按钮，将临时配置保存为永久配置。  |
|  ![移动到新文件夹／创建新文件夹](https://resources.jetbrains.com/help/img/idea/2026.3/app-client.expui.actions.newFolder.svg)  |  |     移入新建文件夹／新建文件夹。 您可以通过 [将它们放入文件夹](run-debug-configuration.html#config-folders)来对运行/调试配置进行分组。       要创建文件夹，请选择某个类别中的配置，点击 ![文件夹](https://resources.jetbrains.com/help/img/idea/2026.3/app-client.expui.nodes.folder.svg)，并指定文件夹名称。 如果只有一个类别处于焦点状态，则会创建一个空文件夹。       然后，为了将配置移动到文件夹中、文件夹之间或者文件夹外，请使用拖拽或 ![上移](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.moveUp.svg) 和 ![下移](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.moveDown.svg) 按钮。       要删除分组，请选择一个文件夹，然后点击 ![移除配置](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.remove.svg)。     |
|  ![排序配置](https://resources.jetbrains.com/help/img/idea/2026.3/app-client.expui.objectBrowser.sortAlphabetically.svg)  |  |  点击此按钮以按字母顺序排序配置。  |

## 启动前

在此区域，您可以指定在启动所选运行/调试配置之前要执行的任务。 任务按它们在列表中出现的顺序执行。

|  项目  |  快捷方式  |  描述  |
| --- | --- | --- |
|  ![添加按钮](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.add.svg)  |  `Alt+Insert` (Windows), `⌘ N` (macOS), `⌃ N` (IntelliJ IDEA Classic (macOS)), `⌘ N` (macOS System Shortcuts), `Alt+Insert` (XWin), `Alt+Insert` (GNOME), `Alt+Insert` (KDE), `Alt+Insert` (Emacs), `Ctrl+N` (Sublime Text), `⌘ N` (Sublime Text (macOS)), `Alt+Insert` (VSCode), `⌃ ⏎` (VSCode (macOS))  |     点击此图标以添加以下可用任务之一：        * 启动 Web 浏览器 ：选择此选项即可启动浏览器。 在打开的对话框中，选择浏览器的类型并提供起始 URL。 此外，请指定是否希望浏览器随 JavaScript 调试器一起启动。    * 运行外部工具 ：选择运行外部应用程序。 在打开的对话框中，选择一个或多个您想要运行的应用程序。 如果它在 GoLand 中尚未定义，请添加其定义。    * 运行另一个配置 ：选择执行另一个运行/调试配置，并等待其完成后再开始当前配置。 如果您想并行运行多个配置，请使用 [compound run/debug configuration](run-debug-multiple.html#compound-configs)。    * 运行 File Watchers ：选择此选项以让 GoLand 应用所有当前活动的 [文件监视器](using-file-watchers.html)。    * 运行远程外部工具 ：添加一个远程 SSH 外部工具。    * 运行 Grunt 任务 ：选择此选项来运行 Grunt 任务。 在打开的 Grunt task 对话框中，指定定义所需任务的 `Gruntfile.js` ，选择要执行的任务，并指定要传递给 Grunt 工具的参数。 指定 Node.js 解释器的位置、传递给它的参数以及 grunt-cli 包的路径。    * 运行 Gulp 任务 ：选择此选项以运行 Gulp 任务。 在打开的 Gulp 任务 对话框中，指定定义所需任务的 `Gulpfile.js` ，选择要执行的任务，并指定要传递给 Gulp 工具的参数。 指定 Node.js 运行时的位置、要传递给它的参数，以及 gulp 包的路径。    * 运行 npm Script ：选择此选项来执行 npm 脚本。 在 NPM Script 对话框中，指定 [npm run/debug configuration settings](null)。    * 编译 TypeScript ：选择运行内置的 TypeScript 编译器，从而确保您对 TypeScript 代码所做的所有更改都反映在生成的 JavaScript 文件中。 在打开的 TypeScript 编译设置 对话框中，选择或清除此 检查错误 复选框，以配置编译器在检测到错误时的行为: * 如果选中了 检查错误 复选框，编译器会显示所有错误，并且运行配置将不会启动。 * 如果清除了 检查错误 复选框，编译器将显示所有检测到的错误，但运行配置仍将启动。    * Go 命令 ：选择此选项以在运行程序之前运行 Go 命令。 例如，您可以运行 `go generate` 以在编译之前生成源代码。 在 编辑 Go 命令任务 对话框中，您可以使用自动补全。 自动补全支持以下命令 `generate` 、 `vet` 、 `test -i` 。 您可以使用自己的命令。    |
|  !["移除"按钮](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.remove.svg)  |  `Alt+Delete` (Windows), `⌘ ⌦` (macOS), `⌘ ⌦` (IntelliJ IDEA Classic (macOS)), `⌘ ⌦` (macOS System Shortcuts), `Alt+Delete` (XWin), `Alt+Delete` (GNOME), `Alt+Delete` (KDE), `Alt+Delete` (Emacs), `Alt+Delete` (Sublime Text), `⌘ ⌦` (Sublime Text (macOS)), `Alt+Delete` (VSCode), `Alt+Delete` (VSCode (macOS))  |  点击此图标可将所选任务从列表中移除。  |
|  ![编辑](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.edit.svg)  |  `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (VSCode), `⏎` (VSCode (macOS))  |  点击此图标可编辑选定的任务。 请在打开的对话框中进行必要的更改。  |
|     ![方法向上](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.moveUp.svg)       ![方法 down](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.moveDown.svg)     |     `Alt+Up` (Windows), `⌃ ⇧ ↑` (macOS), `⌃ ↑` (IntelliJ IDEA Classic (macOS)), `⌃ ⌥ ↑` (macOS System Shortcuts), `Alt+Up` (XWin), `Alt+Up` (GNOME), `Alt+Up` (KDE), `Alt+Up` (Emacs), `Alt+Up` (Sublime Text), `Alt+Up` (Sublime Text (macOS)), `Alt+Up` (VSCode), `Alt+Up` (VSCode (macOS))       `Alt+Down` (Windows), `⌃ ⇧ ↓` (macOS), `⌃ ↓` (IntelliJ IDEA Classic (macOS)), `⌃ ⌥ ↓` (macOS System Shortcuts), `Alt+Down` (XWin), `Alt+Down` (GNOME), `Alt+Down` (KDE), `Alt+Down` (Emacs), `Alt+Down` (Sublime Text), `Alt+Down` (Sublime Text (macOS)), `Alt+Down` (VSCode), `Alt+Down` (VSCode (macOS))     |  点击这些图标以在列表中将所选任务上移或下移一行。 任务将按照它们在列表中出现的顺序执行。  |
|  显示此页面  |  |  选中此复选框以在实际启动运行/调试配置之前显示运行/调试配置设置。  |
|  激活工具窗口  |  |     默认情况下，此复选框处于选中状态，并且在您启动 run/debug 配置时， [Run](run-tool-window.html) 或 [Debug](debug-tool-window.html) 工具窗口会打开。       否则，如果复选框未选中，工具窗口将被隐藏。 但是，在配置运行时，您可以通过按 `Alt+4` (Windows), `⌘ 4` (macOS), `⌘ 4` (IntelliJ IDEA Classic (macOS)), `⌘ 4` (macOS System Shortcuts), `Alt+4` (XWin), `Alt+4` (GNOME), `Alt+4` (KDE), `Alt+4` (Emacs), `Alt+4` (Sublime Text), `⌘ 4` (Sublime Text (macOS)), `Ctrl+Shift+U` (VSCode), `⌘ ⇧ U` (VSCode (macOS)) 或 `Alt+5` (Windows), `⌘ 5` (macOS), `⌘ 5` (IntelliJ IDEA Classic (macOS)), `⌘ 5` (macOS System Shortcuts), `Alt+5` (XWin), `Alt+5` (GNOME), `Alt+5` (KDE), `Alt+5` (Emacs), `Alt+5` (Sublime Text), `⌘ 5` (Sublime Text (macOS)), `Ctrl+Shift+Y` (VSCode), `⌘ ⇧ D` (VSCode (macOS)) 自行打开相应的工具窗口。     |

## See also

### 外部链接

[https://nwjs.io/](https://nwjs.io/)

