Create WebStorm run configurations from package.json “scripts” section

风格不统一 提交于 2019-11-29 22:33:23

you can use Node.js Run configuration for this. For example, for 'npm start':

Working dir: /path/to/your/package.json

JavaScript file: /path/to/global/node_modules/npm/bin/npm-cli.js

Application parameters: run start

To find the global node_modules path from the command line use "npm root -g".

There is no way to auto-create run configurations from files. And the only way to create your own run configuration is developing a plugin - see http://confluence.jetbrains.com/display/IDEADEV/Run+Configurations

Update: since 2016.x, WebStorm provides a special run configuration - npm - for running/debugging NPM scripts. It can be created manually via Edit configurations... dialog, or auto-added by selecting the script in NPM tool window (can be opened from package.json right-click menu).

See https://www.jetbrains.com/help/webstorm/2017.3/running-npm-scripts.html

WebStorm and IntelliJ 2016 included support for NPM scripts as part of the NodeJS plugin.

Scripts are launched in four ways:

  • From a tree of scripts in the dedicated NPM Tool Window. 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.
  • According to a dedicated run configuration, see Run/Debug Configuration: NPM.
  • Automatically, as a start-up task.
  • As a before-launch task, from another run configuration.

For more details check out their documentation.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!