WebStorm和IntelliJ IDEA在NPM运行/调试配置中看不到自定义NPM脚本

时间:2016-12-29 18:29:16

标签: intellij-idea npm webstorm

我无法在WebStorm 2016.3.2或IntelliJ IDEA 2016.3.2的NP​​M运行/调试配置中看到自定义NPM脚本。我选择了正确的package.json文件。

这是我的package.json文件中的脚本部分以及下面屏幕上的运行/调试配置。我无法选择其他自定义命令,例如clean:dist(只有clean),e2epretesttest:passive等。我如何选择这些命令?

"scripts": {
  "clean": "npm cache clean && rimraf coverage src/main/resources/static/*",
  "clean:dist": "rimraf typings src/main/resources/static/*",
  "preclean:install": "npm run clean",
  "clean:install": "npm set progress=false && npm install",
  "preclean:start": "npm run clean",
  "clean:start": "npm start",
  "pree2e": "webdriver-manager update",
  "e2e": "protractor",
  "e2e:live": "protractor --elementExplorer",
  "lint": "tslint './src/main/frontend/**/*.ts' --force",
  "pretest": "rimraf coverage && npm run lint",
  "test:passive": "ng test -w false",
  "test": "ng test",
  "pretest:phantom": "rimraf coverage && npm run lint",
  "test:phantom": "ng test -w false --browsers PhantomJS",
  "build": "npm run build:dev",
  "prebuild:dev": "npm run clean:dist",
  "build:dev": "ng build -dev",
  "prebuild:prod": "npm run clean:dist",
  "build:prod": "ng build -prod",
  "server": "npm run server:dev",
  "server:dev": "ng serve --p 4200 -pc proxy.json -dev",
  "server:prod": "ng serve --p 4200 -pc proxy.json -prod",
  "start": "npm run server:dev",
  "ncu": "ncu -a",
  "ng:upgrade": "ng init -n sqap-ui -sd src/main/frontend --style scss --prefix sqap --routing",
}

Run configuration

1 个答案:

答案 0 :(得分:5)

如果您想运行自定义脚本,请选择run作为命令,然后使用scripts字段中的下拉列表选择您的脚本。 test命令只运行npm test。提示:您可以通过右键单击 NPM 工具窗口中的脚本来创建运行配置,该窗口可以使用package.json右键菜单中的Show npm scripts打开