【问题标题】:Error when trying to run two npm scripts combined尝试同时运行两个 npm 脚本时出错
【发布时间】:2018-04-06 19:14:56
【问题描述】:

我有以下脚本:

"clear": "rimraf lib",
"build": "npm run clear && ./node_modules/.bin/babel --out-dir lib src",
...

当我运行 npm run clear 时效果很好!

如果我运行 ./node_modules/.bin/babel --out-dir lib src,它会按预期运行。

如果我运行npm run clear && ./node_modules/.bin/babel --out-dir lib src,它也可以正常工作。

但是如果我运行 npm run build 我会收到以下错误:

'.' is not recognized as an internal or external command, operable program or batch file

我使用的是 Windows 10。

npm 5.6.0

节点 7.0.0

【问题讨论】:

    标签: npm npm-scripts


    【解决方案1】:

    您可以尝试以下方法:

    "clear": "rimraf lib",
    "build": "./node_modules/.bin/babel --out-dir lib src",
    "clear-build": "npm run clear && npm run build",
    

    然后构建运行:

    npm run clear-build
    

    【讨论】:

      猜你喜欢
      • 2016-12-14
      • 1970-01-01
      • 1970-01-01
      • 2013-11-09
      • 2015-08-04
      • 1970-01-01
      • 2021-01-08
      • 2020-12-18
      相关资源
      最近更新 更多