JetBrains Rider 2019.1 Help

Configuring Remote Node.js Interpreters

In JetBrains Rider, you need to configure a remote Node.js interpreter when you want to run and debug your application on Node.js installed on a remote host or in a virtual environment. This is done in the Configure Node.js Remote Interpreter Dialog dialog that opens only from the Node.js run/debug configuration.

Configuring a remote Node.js interpreter on a host accessible through SSH connection

Before you start

  1. Configure access to an ssh server on the target remote host and make sure this server is running.

  2. Install the NodeJS and NodeJS Remote Interpreter repository plugins on the Plugins page as described in Managing plugins.

To configure a Node.js interpreter using SSH credentials

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

    In the Run/Debug Configuration: Node.js dialog that opens, click the Browse button next to the Node interpreter field.

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

  3. In the Configure Node.js Remote Interpreter Dialog that opens, choose the SSH Credentials method.

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

  5. Specify your credentials to access the remote hostusernamedance with the credentials received during the registration on the server. Type your username and choose the authentication method:

    • Password: to access the host with a password. Specify the password, and select the Save password checkbox to save the password in JetBrains Rider.

    • Key pair (OpenSSH or PuTTY): to use SSH authentication with a key pair. To apply this authentication method, you must have a private key on the client machine and a public key on the remote server. JetBrains Rider supports private keys that are generated with the OpenSSH utility.

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

    • OpenSSH config and authentication agent: to use SSH keys that are managed by a credentials helper application (for example, Pageant on Windows or ssh-agent on Mac and Linux).

  6. Specify the location of the Node.js executable file in accordance with the configuration of the selected remote development environment.
    • For remote hosts, JetBrains Rider by default suggests the /usr/bin/node folder.

    • For Vagrant instances, JetBrains Rider by default suggests the /usr/bin/node folder.

    • For Docker containers, JetBrains Rider by default suggests the node folder.

  7. When you click OK, JetBrains Rider checks whether the Node.js executable is actually stored in the specified folder.

    • If no Node.js executable is found, JetBrains Rider 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 dialog 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

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

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

  3. Install the NodeJS and NodeJS Remote Interpreter repository plugins on the Plugins page as described in Managing plugins.

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

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

    In the Run/Debug Configuration: Node.js dialog that opens, click the Browse button next to the Node interpreter field.

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

  3. In the Configure Node.js Remote Interpreter Dialog that opens, choose the Deployment Configuration method.

  4. From the Deployment Configuration list, choose the server access configuration of the SFTP type according to which you want JetBrains Rider to connect to the target host. If the settings specified in the chosen configuration ensure successful connection, JetBrains Rider 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, JetBrains Rider retrieves path mappings from the chosen server access (deployment) configuration. If the configuration does not contain path mappings, JetBrains Rider displays the corresponding error message.

    To fix the problem, open the Deployment page under the Build, Execution, Deployment node, select the relevant server access configuration, switch to the Mappings tab, and map the local folders to the folders on the server as described in the Map local folders to folders on the server and the URL addresses to access them section.

  5. Specify the location of the Node.js executable file in accordance with the configuration of the selected remote development environment.
    • For remote hosts, JetBrains Rider by default suggests the /usr/bin/node folder.

    • For Vagrant instances, JetBrains Rider by default suggests the /usr/bin/node folder.

    • For Docker containers, JetBrains Rider by default suggests the node folder.

  6. When you click OK, JetBrains Rider checks whether the Node.js executable is actually stored in the specified folder.

    • If no Node.js executable is found, JetBrains Rider 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 dialog 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, JetBrains Rider 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 JetBrains Rider.

Before you start

  1. Download, install, and configure Docker as described in Docker

  2. Install the NodeJS, NodeJS Remote Interpreter, and Docker Integration repository plugins on the Plugins page as described in Managing plugins.

To configure a remote Node.js interpreter in a Docker container

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

    In the Run/Debug Configuration: Node.js dialog that opens, click the Browse button next to the Node interpreter field.

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

  3. In the Configure Node.js Remote Interpreter Dialog that opens, choose the Docker method.

In the Server field, specify the Docker configuration to use, see Configure the Docker daemon connection settings for details. Select a configuration from the list or click the Browse button and create a new configuration in the Docker dialog 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 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. When you click OK, JetBrains Rider closes the Configure Node.js Remote Interpreter Dialog and brings you to the Node.js Interpreters dialog where the new interpreter configuration is added to the list. Click OK to return to the run configuration.

Using a remote Node.js interpreter in a Docker container with a Docker Compose definition

With Docker Compose, you can run a Node.js server and your application code as separate services. Each service can be scaled by adding more containers if necessary. This enables you to perform efficient development and testing in a dynamic environment that is similar to production one.

Configuring mappings

When you debug an application with a remote Node.js interpreter, the debugger tells JetBrains Rider the name of the currently processed file and the number of the line to be processed. JetBrains Rider 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.

To configure mappings

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

  2. In the Run/Debug Configuration: Node.js dialog that opens, choose the required remote interpreter from the Node interpreter list.

  3. Click the Browse button next to the Path Mappings field.

  4. The Edit Project Path Mappings Dialog that opens, shows the path mappings retrieved from the deployment configuration or Vagrantfile. These mappings are read-only.

    • To add a custom mapping, click the Add button 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 the Browse button and select the relevant files or folders in the dialog that opens.

    • To remove a custom mapping, select it in the list and click the Remove button.

Last modified: 11 June 2019