On the main menu, choose Run | Edit Configurations. In the Edit Configuration dialog box that opens, click the Add New Configuration toolbar button , and choose Node.js on the context menu. In the Run/Debug Configuration: Node.js dialog that opens, click next to the Node interpreter field.

In the Node.js Interpreters dialog that opens with a list of all the currently configured interpreters, click on the toolbar. In the dialog box that opens, choose Add Remote on the context menu.

Specify the name of the remote host and the port which the SSH server listens to. The default port number is 22.

Specify your credentials to access the remote host in accordance with the credentials received during the registration on the server. Type your user name and choose the authentication method:

To access the host through a password, choose Password from the Auth type drop-down list, specify the password, and select the Save password checkbox to have IntelliJ IDEA remember it.

To use SSH authentication via a key pair, choose Key pair (OpenSSH or PuTTY). To apply this authentication method, you need to have your private key on the client machine and your public key on the remote server you connect to. IntelliJ IDEA supports private keys generated using the OpenSSH utility.

Specify the path to the file where your private key is stored and type the passphrase (if any) in the corresponding text boxes. To have IntelliJ IDEA remember the passphrase, select the Save passphrase checkbox.

If your SSH keys are managed by a credentials helper application (for example, Pageant on Windows or ssh-agent on Mac and Linux), choose Authentication agent (ssh-agent or Pageant).

Specify the location of the Node.js executable file in accordance with the configuration of the selected remote development environment. By default IntelliJ IDEA suggests the /usr/bin/node folder for remote hosts and Vagrant instances and node for Docker containers. To specify a different folder, click Browse and choose the relevant folder in the dialog box that opens. Note that the Node.js home directory must be open for edit.

When you click OK, IntelliJ IDEA checks whether the Node.js executable is actually stored in the specified folder.

If no Node.js executable is found, IntelliJ IDEA displays an error message asking you whether to continue searching or save the interpreter configuration anyway.

If the Node.js executable is found, you return to the Node.js Interpreters where the installation folder and the detected version of the Node.js interpreter are displayed.

Configuring a remote Node.js interpreter in a Vagrant environment instance

Configure the Node.js development environment in the Vagrant instance to be used. Learn more about using Vagrant with IntelliJ IDEA in Vagrant.

To configure a Node.js Interpreter in a Vagrant instance

On the main menu, choose Run | Edit Configurations. In the Edit Configuration dialog box that opens, click the Add New Configuration toolbar button , and choose Node.js on the context menu. In the Run/Debug Configuration: Node.js dialog that opens, click next to the Node interpreter field.

In the Node.js Interpreters dialog that opens with a list of all the currently configured interpreters, click on the toolbar. In the dialog box that opens, choose Add Remote on the context menu.

Specify the Vagrant instance folder which points at the environment you are going to use. Technically, it is the folder where the VagrantFile configuration file for the desired environment is located. Based on this setting, IntelliJ IDEA detects the Vagrant host and shows it as a link in the Vagrant Host URL read-only field.

Specify the location of the Node.js executable file in accordance with the configuration of the selected remote development environment. By default IntelliJ IDEA suggests the /usr/bin/node folder for remote hosts and Vagrant instances and node for Docker containers. To specify a different folder, click Browse and choose the relevant folder in the dialog box that opens. Note that the Node.js home directory must be open for edit.

When you click OK, IntelliJ IDEA checks whether the Node.js executable is actually stored in the specified folder.

If no Node.js executable is found, IntelliJ IDEA displays an error message asking you whether to continue searching or save the interpreter configuration anyway.

If the Node.js executable is found, you return to the Node.js Interpreters where the installation folder and the detected version of the Node.js interpreter are displayed.

Configuring a remote Node.js interpreter on a remote host accessible through SFTP

Before you start:

Make sure a ssh server is running on the target remote host and you have configured access to it.

Make sure you have at least one IntelliJ IDEA-wide server access configuration of the SFTP type to establish access to the target host. To make a configuration available in all IntelliJ IDEA projects, clear the Visible only for this project checkbox in the Deployment: Connection Tab. See Creating a Remote Server Configuration for details.

To configure a remote Node.js interpreter based on an SFTP server access configuration

On the main menu, choose Run | Edit Configurations. In the Edit Configuration dialog box that opens, click the Add New Configuration toolbar button , and choose Node.js on the context menu. In the Run/Debug Configuration: Node.js dialog that opens, click next to the Node interpreter field.

In the Node.js Interpreters dialog that opens with a list of all the currently configured interpreters, click on the toolbar. In the dialog box that opens, choose Add Remote on the context menu.

From the Deployment Configuration drop-down list, choose the server access configuration of the SFTP type according to which you want IntelliJ IDEA to connect to the target host. If the settings specified in the chosen configuration ensure successful connection, IntelliJ IDEA displays the URL address of the target host as a link in the Deployment Host URL field.

To use an interpreter configuration, you need path mappings that set correspondence between the project folders, the folders on the server to copy project files to, and the URL addresses to access the copied data on the server. By default, IntelliJ IDEA retrieves path mappings from the chosen server access (deployment) configuration. If the configuration does not contain path mappings, IntelliJ IDEA displays the corresponding error message.

Specify the location of the Node.js executable file in accordance with the configuration of the selected remote development environment. By default IntelliJ IDEA suggests the /usr/bin/node folder for remote hosts and Vagrant instances and node for Docker containers. To specify a different folder, click Browse and choose the relevant folder in the dialog box that opens. Note that the Node.js home directory must be open for edit.

When you click OK, IntelliJ IDEA checks whether the Node.js executable is actually stored in the specified folder.

If no Node.js executable is found, IntelliJ IDEA displays an error message asking you whether to continue searching or save the interpreter configuration anyway.

If the Node.js executable is found, you return to the Node.js Interpreters where the installation folder and the detected version of the Node.js interpreter are displayed.

Configuring a remote Node.js interpreter in a Docker container

You can quickly bootstrap your Node.js application with Docker, IntelliJ IDEA will take care of the initial configuration by automatically creating a new Dockerfile, keeping your source code up-to-date and installing npm dependencies in the container. Configuring a Node.js environment running in a Docker container as a Node.js remote interpreter lets you run, debug, and profile your Node.js application from IntelliJ IDEA.

Before you start:

Make sure the Node.js, Node.js Remote Interpreter, and Docker Integration plugins are installed and enabled. The plugins are not bundled with IntelliJ IDEA, but they can be installed from the JetBrains plugin repository as described in Installing, Updating and Uninstalling Repository Plugins and Enabling and Disabling Plugins. Once enabled, the plugins are available at the IDE level, that is, you can use them in all your IntelliJ IDEA projects.

On the main menu, choose Run | Edit Configurations. In the Edit Configuration dialog box that opens, click the Add New Configuration toolbar button , and choose Node.js on the context menu. In the Run/Debug Configuration: Node.js dialog that opens, click next to the Node interpreter field.

In the Node.js Interpreters dialog that opens with a list of all the currently configured interpreters, click on the toolbar. In the dialog box that opens, choose Add Remote on the context menu.

In the Server field, specify the Docker configuration to use, see Docker. Choose a configuration from the drop-down list or click next to it and create a new configuration in the Docker dialog box that opens.

In the Image name field, specify the base Docker image to use. Choose one of the previously downloaded or your custom images from the drop-down list or type the image name manually, for example, node:argon or mhart/alpine-node. When you later launch the run configuration, Docker will search for the specified image on your machine. If the search fails, the image will be downloaded from the image repository specified on the Registry page.

The Node.js interpreter path field shows the location of the default Node.js interpreter from the specified image.

Configuring mappings

When you debug an application with a remote Node.js interpreter, the debugger tells IntelliJ IDEA the name of the currently processed file and the number of the line to be processed. IntelliJ IDEA opens the local copy of this file and indicates the line with the provided number. This behaviour is enabled by specifying correspondence between files and folders on the server and their local copies. This correspondence is called mapping, it is set in the debug configuration.

If you use an interpreter accessible through SFTP connection or located on a Vagrant instance, the mappings are automatically retrieved from the corresponding deployment configuration or Vagrantfile. To specify additional mappings:

On the main menu, choose Run | Edit Configurations. In the Edit Configuration dialog box that opens, click the Add New Configuration toolbar button , and choose Node.js on the context menu.

To add a custom mapping, click and specify the path in the project and the corresponding path on the remote runtime environment in the Local Path and Remote Path fields respectively. Type the paths manually or click and select the relevant files or folders in the dialog box that opens.