我正在尝试使用Concurrently软件包同时运行多个命令。
我的package.json
:
{
"name": "emojifier",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start-dev": "concurrently -c \"yellow.bold,green.bold\" -n \"SERVER,BUILD\" \"./node_modules/.bin/ts-node-dev server/index.ts\" \"ng build --watch\" \"ng serve\""
}
}
此脚本在Ubuntu和Mac上运行良好。但是,通过CMD
或Powershell运行它时,出现错误:
[SERVER] '.' is not recognized as an internal or external command,
[SERVER] operable program or batch file.
[SERVER] ./node_modules/.bin/ts-node-dev server/index.ts exited with code 1
为什么会发生这种情况,什么是适当的解决方法?这是并发错误吗?
当我将正斜杠切换为反斜杠时:
concurrently -c "yellow.bold,green.bold" -n "SERVER,BUILD" ".\node_modules\.bin\ts-node-dev.cmd .\server\index.ts" "ng build --watch" "ng serve"
错误已解决。
如果我从路径名中删除了./
前缀,则错误将变为:
[SERVER] 'node_modules' is not recognized as an internal or external command,
[SERVER] operable program or batch file.
[SERVER] node_modules/.bin/ts-node-dev server/index.ts exited with code 1