Open Robin-Hoodie opened 3 years ago
I just ran into this myself. If you quote the *
then yarn won't try to handle the wildcard and run -p
will work as expected.
Try this:
"scripts": {
"echo:bar": "echo 'bar'",
"echo:foo": "echo 'foo'",
"echo": "run-p 'echo:*'"
}
Thanks for the tip, that works!
I do think the root cause of this should be fixed however (whether here or in Yarn 2) If not that, at minimum some documentation can be added
I ended up falling for that too. Please add it to the documentation
I don't think this is a bug for both sides. Please don't get mad at me; I was also confused by the error. However, *
is a valid shell syntax for globs, and Yarn implements a bash-like shell that presumably expands the wildcard.
It seems like expanding the wildcard is the expected behaviour of Yarn, and it doesn't look like npm-run-all
can solve it either.
I just ran into this myself. If you quote the
*
then yarn won't try to handle the wildcard andrun -p
will work as expected.Try this:
"scripts": { "echo:bar": "echo 'bar'", "echo:foo": "echo 'foo'", "echo": "run-p 'echo:*'" }
Thanks very much for this. I had to line up all related script commands on one line as I didn't know what to do.
Hey, just had the issue too.
it doesn't look like npm-run-all can solve it either.
Agree, but adding it to the doc could be a good help, it avoids people to look for this issue 🙂.
Ditto to all of the above. Thank goodness for github issues and threads like these. This was the first thing that broke when I updated to yarn 2, given that the docs say it will work with yarn this was a little confusing to find the solution here.
Adding double quotes works for me in Yarn 4.0.0-rc.27:
"scripts": {
"echo:bar": "echo \"bar\"",
"echo:foo": "echo \"foo\"",
- "echo": "npm-run-all echo:*"
+ "echo": "npm-run-all \"echo:*\""
}
Otherwise, it says No matches found: "echo:*"
. Using double quotes for compatibility with cmd.exe
.
I find it odd that this works for all the other manager packages (npm, yarn classic, pnpm, bun), but not for modern Yarn. 😅
Running a script
echo: run-p echo:*
defined inpackage.json
will not work on Yarn 2.Example
package.json
:To reproduce:
yarn init -y
yarn add -D npm-run-all
package.json
:"echo:foo": "echo 'foo'"
"echo:bar": "echo 'bar'"
"echo": "run-p echo:*"
yarn set version berry
yarn echo
=> No matches found: "echo:*"
Oddly enough, running
yarn run-p echo:*
directly does still workReproduction repo: https://github.com/Robin-Hoodie/yarn2-npm-run-all-repro