Precommit hook for `.all-contributorsrc` fails on Windows because of space in path to node binary
iki opened this issue Β· comments
cross-env
version: masternode
version: 9.4.0npm
(oryarn
) version: 5.6.0os
: Microsoft Windows [Version 10.0.15063]
What you did:
git checkout https://github.com/kentcdodds/cross-env
cd cross-env
npm install
npm run validate
node_modules\.bin\all-contributors.cmd # npm run add-contributor didn't work see #168
git add .all-contributorsrc README.md
git commit -m "docs(README): add contributor"
See #168
What happened:
husky > npm run -s precommit (node v9.4.0)
25l[08:46:38] Running tasks for **/*.+(js|json|less|css|ts) [started]
[08:46:38] Running tasks for .all-contributorsrc [started]
[08:46:38] Running tasks for **/*.+(js|json|less|css|ts) [skipped]
[08:46:38] β No staged files match **/*.+(js|json|less|css|ts)
[08:46:38] C:\Program Files\nodejs\node.exe C:\Users\iki\code\cross-env\node_modules\kcd-scripts\dist\index.js contribut
ors generate [started]
[08:46:38] C:\Program Files\nodejs\node.exe C:\Users\iki\code\cross-env\node_modules\kcd-scripts\dist\index.js contribut
ors generate [failed]
[08:46:38] β C:\Program could not be found. Try `npm install C:\Program`.
[08:46:38] Running tasks for .all-contributorsrc [failed]
[08:46:38] β C:\Program could not be found. Try `npm install C:\Program`.
25hC:\Program could not be found. Try `npm install C:\Program`.
25h
husky > pre-commit hook failed (add --no-verify to bypass)```
Reproduction repository: https://github.com/kentcdodds/cross-env
Problem description: The precommit hook for .all-contributorsrc
fails on Windows, because it does not quote path to node binary and fails when there's space in the path.
Suggested solution: Quote path to node binary properly.
Ah, yes, this is a problem in kcd-scripts
and should definitely be fixed. Thanks for the report!
Actually, I think this is a problem in lint-staged
π€
Could you try this? Make a change to the .all-contributorsrc
file (any change at all, doesn't matter), then run:
cmd /C "set DEBUG=lint-staged:* && git commit -am stuff"
This will print out a bunch of debug information. Paste all the output here. Thanks!
@kentcdodds I set DEBUG=lint-staged:*
, updated .all-contributorsrc
and run git commit -am stuff
, but got exactly the same result as above, no other messages were printed. The same with DEBUG=*
. Is there anything else I can try?
Thanks for digging! I'm not sure why that didn't work! You might consider diving into your node_modules and adding some console.logs in places to figure out what's going on. I'm not sure what the problem is and without a windows machine it's hard for me to do much digging :-/
Good luck! And thanks again for anything you can help with!