作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我在 Windows 上运行 npm 并希望在运行脚本中使用 & 风格的并行操作但是在cmd中并行运行有点乱在我的 package.json 文件中,我想写-
scripts: { "go": "cmd1 & cmd2"}
但 npm 在 cmd.exe 下执行脚本,它不知道 ;
我可以将其更改为scripts: { "go": "bats/bat1.bat")
其中 bat1.bat 是一个 cmd bat 文件,它使用 windows 风格的调用或启动命令来并行运行命令。这有效,但给了我一个只适用于 Windows 的脚本。
如果我能让 npm 在 bash 克隆或 cygwin 下运行脚本,那就简单多了。
我试过了配置:{“shell”:“bash”}
但它仍然运行 cmd.exe
有没有办法告诉 npm 使用特定的 shell(不是 cmd.exe)运行脚本?
最佳答案
从 npm 5.1 开始
npm config set script-shell "C:\\Program Files (x86)\\git\\bin\\bash.exe"
或(64位安装)
npm config set script-shell "C:\\Program Files\\git\\bin\\bash.exe"
请注意,您需要有 git for windows installed .
npm config delete script-shell
关于windows - 如何在 Windows 中为 npm run-scripts 设置 shell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23243353/
我是一名优秀的程序员,十分优秀!