【发布时间】:2014-06-08 05:31:48
【问题描述】:
我在 Windows 上运行 npm,并希望在运行脚本中使用 & 样式并行操作 但是在cmd中并行运行有点混乱 在我的 package.json 文件中我想写 -
scripts: { "go": "cmd1 & cmd2"}
但是 npm 在不知道 ; 的 cmd.exe 下执行脚本,我可以将其更改为
脚本:{ "go": "bats/bat1.bat") 其中 bat1.bat 是一个 cmd bat 文件,它使用 windows 样式调用或启动命令来并行运行命令。它有效,但给了我一个仅适用于 Windows 的脚本。
如果我可以让 npm 在 bash 克隆或 cygwin 下运行脚本会简单得多。
我试过了
config: { "shell": "bash"}
但仍然运行 cmd.exe
有没有办法告诉 npm 使用特定的 shell(不是 cmd.exe)运行脚本?
【问题讨论】:
-
是否 [仍然] 无法在 package.json 中指定 shell?我将 npm 用于 windows 和 bash 脚本,并且无法覆盖特定 package.json 的默认“shell”或“script-shell”设置?