New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Windows] [lint-staged] [GitHub Desktop] .husky/pre-commit script is unable to find npx
#1292
Comments
It may be a little strange workaround, but in the end we have to run it via a package manager only because node_modules/.bin is not added to the path so husky cannot find the relevant commands. If you were to manually modify the path it would work just fine without it. #!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
export PATH="$PATH:./node_modules/.bin"
lint-staged --debug Works with nested projects as well, just modify the path to node_modules since it's run from the top level directory. I prefer this method over yours, since lint-staged might run other scripts that will also be unrecognized by husky otherwise. |
Is there any solution to this problem? Please help me (without changing the PATH) |
Troubleshoot
https://typicode.github.io/husky/troubleshooting.html
Context
Please describe your issue and provide some context:
Error:
However I can
git commit
just fine in PowerShell or CMD, and it runs the hooks. I can seenpx
and other commands in my Path.I get this issue when trying to commit in GitHub Desktop.
Workaround:
Using the direct path to the executable without
npx
solved the issue for now:Thank you!
The text was updated successfully, but these errors were encountered: