Yarn: Yarn Run - The syntax of the command is incorrect.

Created on 14 Feb 2019  路  2Comments  路  Source: yarnpkg/yarn

Do you want to request a feature or report a bug?

Bug
What is the current behavior?
I have a script in my package.json
"scripts": { "build:vendor": "mkdir -p demo/assets/js/ && node tools/run build-vendor" }

If I run yarn run build:vendor I get the following output & error:
$ yarn run build:vendor yarn run v1.13.0 $ mkdir -p demo/assets/js/ && node tools/run build-vendor The syntax of the command is incorrect. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

If just run mkdir -p demo/assets/js/ && node tools/run build-vendor it works as expected.

Code is taken from - https://github.com/kevinchappell/formBuilder

What is the expected behavior?
Should run error free.

Please mention your node.js, yarn and operating system version.
Windows 10
Yarn v1.13.0
Node v10.14.0

triaged

Most helpful comment

I have the exact same issue.

Windows 10
Yarn v1.17.3
Node: v10.15.2

Edit:
Okay, I found a workaround: you have to use escaped backslashes instead of single forward slashes for the mkdir command, like this:

"scripts": { "build:vendor": "mkdir demo\\assets\\js && node tools/run build-vendor" }

But of course this is still a bug which should be fixed.

All 2 comments

I got same problem.
-p directory was created by mkdir via script of package.json.

Windows 10
Yarn v1.17.3
Node: v10.14.1

I have the exact same issue.

Windows 10
Yarn v1.17.3
Node: v10.15.2

Edit:
Okay, I found a workaround: you have to use escaped backslashes instead of single forward slashes for the mkdir command, like this:

"scripts": { "build:vendor": "mkdir demo\\assets\\js && node tools/run build-vendor" }

But of course this is still a bug which should be fixed.

Was this page helpful?
0 / 5 - 0 ratings