NPM Tool Window
On this page:
- Accessing the npm Tool Window
- Building a Tree of npm Scripts
- Running npm Scripts
- Context Menu of a Tree
- Context Menu of a Script
Accessing the npm Tool Window
The tool window is available only when:
- The Node.js runtime environment is installed on your computer.
- The NodeJS repository plugin is installed and enabled. The plugin is not bundled with RubyMine, but it can be installed from the JetBrains plugin repository as described in Installing, Updating and Uninstalling Repository Plugins and Enabling and Disabling Plugins.
At least one
package.jsonfile is available in the current project.
The tool window opens when you invoke npm by choosing Show npm Scripts
on the context menu of a
package.json in the Project tool window
or of a
package.json opened in the editor.
Use the tool window to run npm scripts.
As soon as you invoke npm, it starts building a tree of scripts defined within the
scripts property of the
package.json file on which it was invoked.
If you have several
package.json files in your project, you can build a separate script tree for each of them and run scripts without abandoning the previously built trees.
Each tree is shown under a separate node.
Building a Tree of npm Scripts
To build a tree of scripts, do one of the following:
Select the required
package.jsonfile in the Project tool window and choose Show npm Scripts on the context menu of the selection.
Open the required
package.jsonfile in the editor and choose Show npm Scripts on the context menu of the editor.
If the npm tool window is already opened, click on the toolbar and
choose the required
package.jsonfile from the list. RubyMine adds a new node and builds a scripts tree under it. The title of the node shows the path to the
package.jsonfile according to which the tree is built.
- To re-build a tree, switch to the required node and click on the toolbar.
By default, the scripts in a tree a listed in the order in which they are defined in
package.json (option Definition order).
To have them listed in the alphabetic order, click the toolbar button, then choose Sort by
on the menu, and then choose Name.
Running npm Scripts
To run a script from the tree, do one of the following:
- Double click the required script in the tree.
- Select the required script and choose Run <script name> on the context menu of the selection.
- Select the required script and press Enter.
The tool window shows the npm script output, reports the errors occurred, lists the packages or plugins that have not been found, etc. The name of the last executed script is displayed on the title bar of the tool window.
To run several scripts, use the multiselect mode: hold Shift (for adjacent items) or Ctrl (for non-adjacent items) keys and select the required scripts, then choose Run on the context menu of the selection.
Click this button to have a tree of scripts for another |
|Remove package.json||Click this button to remove the tree of scripts under the selected node.|
Click this button to have the tree of scripts under the selected node re-built.
You may need a tree re-built after updating the corresponding |
Click this button to hide all the scripts trees and have only |
Click this button to configure the current view and to change the viewing modes of the tool window, see Viewing Modes for details.
Note that most of the menu items are options that you can turn on or off. An option which is on has a check mark to the left of its name.
The npm-specific options are:
|Hide||Click this button to hide the tool window. To have it displayed again, choose on the main menu. The tool window appears again showing all the previously built trees of tasks.|