IntelliJ IDEA 15.0 Help

Node.js

IntelliJ IDEA supports integration with the Node.js runtime environment thus enabling running, debugging, and unit testing of Node.js applications.

IntelliJ IDEA recognizes Node.js code and provides basic coding assistance and highlighting for it. To get guidance in Node development, see HowToNode.org.

In this section:

Before You Start

  1. Download and install the Node.js runtime environment.
  2. Install and enable the NodeJS plugin. The plugin is not bundled with IntelliJ IDEA, but it can be installed from the JetBrains plugin repository as described in Installing, Updating and Uninstalling Repository Plugins and Enabling and Disabling Plugins.

The Node.js plugin introduces the following changes to the IntelliJ IDEA UI:

  • Node.js page is added to the Settings dialog box.
  • Run/debug configurations are added.

Configuring Node.js in IntelliJ IDEA

  1. Open the Settings / Preferences Dialog by choosing File | Settings , and click Node.js and NPM under Languages & Frameworks.
  2. On the Node.js and NPM page that opens, specify the location of the desired Node.js interpreter.
  3. In the Code Assistance area, configure the Node.js core module sources if they are not configured yet.

    When developing a Node.js application it can be convenient to have code completion, reference resolution, validation, and debugging capabilities for Node core modules (fs\, path, http, etc.). However, these modules are compiled into the Node.js binary. IntelliJ IDEA provides the ability to configure these sources as a JavaScript library and associate it with your project.

    • If the Node.js core module sources are not set up, IntelliJ IDEA displays a notification Node.js Core Library is not enabled with an Enable button. Click this button to have IntelliJ IDEA configure Node.js Core sources automatically.

      When the configuration is completed, IntelliJ IDEA displays information about the currently configured version, the notification Node.js Core Library is enabled, and adds two buttons: the Disable button and the Usage scope button.

    • If the library is set up, IntelliJ IDEA displays information about the currently configured version, the notification Node.js Core Library is enabled, and adds two buttons: the Disable button and the Usage scope button.
      • Click the Disable button to discard the configuration of the Node.js Core libraries in the current project.
      • Click the Usage scope button to associate the desired directories with libraries.
  4. If necessary, configure the scope in which the Node.js Core sources are treated as libraries. Click the Usage scope button, and in the Usage Scope dialog box that opens, click the desired directories, and from the drop-down list select the newly configured Node.js core module sources library.

    The use of a library is enabled recursively, that is, if a library is associated with a folder it is automatically enabled in all the nested directories and files.

See Also

Last modified: 10 December 2015