npm run causes "The syntax of the command is incorrect"

Viewed 123

In a node project I have the following "build" task:

"scripts": {
    "build": "rm -rf build/ && rm -rf app/ && prettier --write source/ && tsc && cp -r ../app/dist/. ./build/app && mkdir build/app/config"
}

This runs fine on MacOS but when running on windows I use the git bash to run it because with PowerShell rm fails. But when running npm run from the git bash I get an error:

The syntax of the command is incorrect.

But when I run each command individually or execute just

rm -rf build/ && rm -rf addin/ && prettier --write source/ && tsc && cp -r ../addin/dist/. ./build/addin && mkdir build/addin/config

directly all together in the bash it seems all to work.

What could could be the issue? Why doesn't it work through npm run build in git bash on Windows?

0 Answers
Related