npm-run-all
npm-run-all copied to clipboard
Doesn't work well with Yarn
I see some previous commits and changes to make it work with Yarn, but it doesn't work for me on Win10CU. I modified some code in run-task.js and now it runs like a champ. I'm sure this entire if/else can be condensed a little bit.
if (path.extname(options.npmPath || "a.js") === ".js") {
const npmPath = options.npmPath || process.env.npm_execpath //eslint-disable-line no-process-env
const execPath = npmPath ? npmPath : "npm"
const spawnArgs = [].concat(
["run"],
options.prefixOptions,
parseArgs(task)
)
// Execute.
cp = spawn(execPath, spawnArgs, spawnOptions)
}
I have the same issue with nodejs 6.10.3, yarn 0.24.5, and npm-run-all 4.0.2 on Windows 10 1607 64bit. Using npm 3.10.10 instead of yarn works for me.
Thank you for this issue.
However, I'm using Windows 7 Pro and I could not reproduce it. Could you tell me the repro steps?
package.json:
{
"name": "sandbox",
"version": "1.0.0",
"description": "",
"scripts": {
"test": "run-s a",
"a": "node -p \"process.env.npm_execpath\""
},
"author": "Toru Nagashima (https://github.com/mysticatea)",
"license": "MIT"
}
Command:
~\Documents\GitHub\sandbox> yarn run test
yarn run v0.24.4
$ run-s a
yarn run v0.24.4
$ node -p "process.env.npm_execpath"
C:\Users\t-nagashima.AD\nodist\bin\node_modules\yarn\bin\yarn.js
Done in 0.38s.
Done in 1.23s.
~\Documents\GitHub\sandbox>
Using package.json you provided.
$ yarn add --dev npm-run-all
yarn add v0.24.5
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 64 new dependencies.
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
Done in 8.86s.
$ yarn run test
yarn run v0.24.5
$ run-s a
yarn run v0.24.5
$ node -p "process.env.npm_execpath"
C:\Program Files (x86)\Yarn\bin\yarn.js
Done in 0.23s.
Done in 1.00s.
$ yarn run test
yarn run v0.24.5
$ run-s a
^C
run-s a
won't run in the second time. I hit Ctrl+C.
I noticed that yarn run test
runs successfully in odd time,
and it fails in even time.
- node 6.10.3 x64
- yarn 0.24.5
- Windows 10 x64 1607 14393.1198
I also tested it on another machine, which installed older yarn. The issue did not happen.
- node 6.10.3 x64
- yarn 0.23.4
- Windows 10 x64 1607 14393.1198
After upgrading yarn to 0.24.5, the issue was reproduced.
Thank you. I'll check it.
.... [email protected]
does not seem to be published to npm.
> npm show yarn dist-tags
{ latest: '0.24.4', rc: '0.25.2' }
You can get yarn v0.24.5 at GitHub release. It is not recommended to install yarn via npm. I also reproduced the issue with v0.24.3 and v0.24.4. I have not tested with pre-released v0.24.[0-2].
Hmm, I could not reproduce it with [email protected]
on PowerShell and cmd.exe on Windows 7.
I'll check on Windows 10 later.
I also cannot reproduced the issue with PowerShell and Command Prompt on Windows 10. But I can reproduced it with bash bundled with Git for Windows. I tested 2 versions of bash and both of them have the issue.
git version 2.11.1.windows.1 GNU bash, version 4.3.46(2)-release (x86_64-pc-msys)
git version 2.13.0.windows.1 GNU bash, version 4.4.12(1)-release (x86_64-pc-msys)
The terminal for bash is mintty, the default terminal of Git for Windows. If bash is executed from cmd.exe, the issue does not happen.
Thank you for the information.
Yeah, Git Bash of Windows is super problematic about stdin/stdout.
I'm guessing related to https://github.com/nodejs/node/issues/5620. Please try defining the following alias. (This is similar to https://github.com/nodejs/node/issues/5620#issuecomment-262887207)
$ alias -p yarn="winpty yarn.cmd"
Thank you for workarounds. Defining the alias or hitting enter key solves the issue.
Thank you.
Actually this is a bug of Node.js or MinGW.
The process.stdin
getter of Node.js hungs up on specific cases if you are using MinGW.
winpty
is the workaround of MinGW side.
I'm not sure whether I can do something in npm-run-all
.