Open nfantone opened 3 years ago
It's due to the glob pattern. Yarn is expanding the glob and not sending it to npm-run-all
. If you wrap the glob in quotes, it should work.
"build": "npm-run-all clean --parallel 'build:*'",
See also: https://github.com/mysticatea/npm-run-all/issues/200
@TreTuna It's been a while since I posted this, so I cannot truly confirm what you're saying. But judging from my original comments, that wouldn't explain why yarn run-s clean
(which does not set any glob patterns) doesn't work.
Also, the issue you're pointing at is related to yarn
v2. My issue is reproducible in 1.22.10
.
The error is very similar to mine, except that I'm getting it with npm@7.8.0
(that is, without yarn
at all), but on npm@6.14
it works fine:
$ npm --version
7.8.0
$ npm run build:cat
> coreutils@0.0.0 build:cat
> cd src/uu/cat && wasm-pack build && npx pkg2wef
# ...executes successfully
$ npx npm-run-all build:cat
Watching /home/snejugal/projects/wubix-crates/coreutils and all sub-directories not excluded by your .gitignore. Will not monitor dotfiles.
Found & ignored ./node_modules ; is listed in .gitignore
Starting: build:cat
node:internal/modules/cjs/loader:928
throw err;
^
Error: Cannot find module '/home/snejugal/projects/wubix-crates/coreutils/build:cat'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:15)
at Function.Module._load (node:internal/modules/cjs/loader:769:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
^C # note: it doesn't exit but stuck in some infinite loop wasting CPU time
$ npx npm-run-all --version
v4.1.5
$ npm i -g npm@6
removed 58 packages, changed 11 packages, and audited 436 packages in 6s
3 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
$ npm --version
6.14.12
$ npx npm-run-all build:cat
> coreutils@0.0.0 build:cat /home/snejugal/projects/wubix-crates/coreutils
> cd src/uu/cat && wasm-pack build && npx pkg2wef
# ...executes successfully as well
$ npx npm-run-all --version
v4.1.5
FWIW, the repo is public: https://gitlab.com/wubix-crates/coreutils (note that if you try to execute npm run build
, it's going to compile Rust code to WASM, so for reproduction getting an error like wasm-pack: command not found
is enough)
I ran into this issue with Yarn Classic (v1) and the workaround was to downgrade from npm v7 to npm v6:
npm i -g npm@6
@petermikitsh worked for me too, any idea why the downgrade is even a solution though?
change from
"build": "npm-run-all clean --parallel build:*",
to
"build": "npm-run-all clean --parallel 'build:*'",
While having the following scripts on
package.json
:running
npm run build
works fine and does exactly what is expected. Usingyarn
, however, fails with a bunch of exceptions.Interestingly, this only seems to happen if scripts include
run-s
,run-p
ornpm-run-all
calls. For instance, running simplyyarn clean
(which invokesrimraf
) works, but runningyarn run-s clean
fails with the same exception shown above.Using: