

Choose the required package.json file from the list. Use the multiselect mode: hold Shift (for adjacent items) or Ctrl (for non-adjacent items) keys and select the required scripts, then choose Run or Debug from the context menu of the selection.Ĭlick this button to have a tree of scripts for another package.json file built. Select the script in the tree and press Enter or choose Run from the context menu. To sort the scripts in a tree by their namesĬlick on the toolbar, choose Sort by from the menu, and then choose Name.īy default, a tree shows the scripts in the order in which they are defined in package.json (option Definition order). Switch to the required node and click on the toolbar. PhpStorm adds a new node with the path to the chosen package.json file on its title and builds a scripts tree under the new node. If you have another package.json file, click Choose package.json and select the package.json file you need in the dialog that opens. By default, PhpStorm shows the package.json file in the root of your project. In the npm tool window, click on the toolbar and choose the required package.json file from the list. Select the required package.json file in the Project tool window or open it in the editor and choose Show npm Scripts from the context menu. To build a tree of scripts, do one of the following: The name of the last executed script is displayed on the title bar of the tool window. The tool window shows the script output, reports the errors occurred, lists the packages or plugins that have not been found, etc.

Each tree is shown under a separate node. 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 dropping the previously built trees. The npm tool window opens when you select a package.json file in the Project tool window or open it in the editor and select Show npm Scripts from the context menu.Īs soon as you invoke npm, pnpm, or Yarn, the tool starts building a tree of scripts defined within the scripts property of the package.json file on which it was invoked. Press Shift twice to open the search window, start typing your query, for example, npm scripts, and select Show npm scripts from the list.Īlternatively, select View | Tool Windows | npm from the main menu.

If you already opened the npm tool window, you can access it with Search everywhere. When you build a tree of tasks for the first time during a PhpStorm session, the npm tool window is not opened yet. To use Yarn, install it as described on the Yarn official website. Note that npm is also installed so if you are going to use it, you are through with the preliminary steps. Before you startĭownload and install Node.js.

Use the tool window to run npm, pnpm, or Yarn scripts.
