Skip to content
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

husky with sourcetree? #103

Closed
badtant opened this issue Feb 28, 2017 · 12 comments
Closed

husky with sourcetree? #103

badtant opened this issue Feb 28, 2017 · 12 comments
Labels

Comments

@badtant
Copy link

badtant commented Feb 28, 2017

I'm trying to use husky precommit with sourcetree. The precommit command is run but i get the following error:
env: node: No such file or directory

Does anybody know what's wrong? I'm using nvm.

@iamstarkov
Copy link

have you read tricks in the README?

@badtant
Copy link
Author

badtant commented Feb 28, 2017

yes, and I didn't find any trick there. I'm fine with using what nvm has set as default but I don't think that is where my problem is.

@badtant
Copy link
Author

badtant commented Feb 28, 2017

I had some old node stuff except for nvm but I've removed that now and now I get this error:

.git/hooks/pre-commit: line 11: exists: command not found
.git/hooks/pre-commit: line 11: exists: command not found

husky - Can't find npm in PATH. Skipping precommit script in package.json

So if I understand correctly the command "exists" is not found and therefor nvm is not loaded.

@typicode
Copy link
Owner

Hi @badtant,

Seems like it's a bug and more particularly a typo. Could you try replacing exists with command_exists in .git/hooks/pre-commit?

@typicode typicode added the bug label Mar 1, 2017
@typicode
Copy link
Owner

typicode commented Mar 2, 2017

Actually there's @rainboxx's PR that fixes it, a new version should be published soon.

@typicode
Copy link
Owner

typicode commented Mar 3, 2017

@badtant PR has been merged and new version has been published, it should better now :)

@iamstarkov
Copy link

@badtant can you verify it with new husky's version?

@badtant badtant closed this as completed Mar 3, 2017
@ohana54
Copy link

ohana54 commented Mar 18, 2017

I still had an issue with SourceTree, adding this comment in case it helps someone.
The pre-commit-hook looks for npm, and I had a leftover npm in /usr/local/bin, so the hook didn't run nvm like it's supposed to.
I removed usr/local/bin/npm, the hook then properly ran nvm use and everything worked.

@rainboxx
Copy link
Contributor

@ohana54 check out the discussion at #101. The code has changed but it was loading nvm when there's a .nvmrc file in the project folder, even when npm was in the path. We didn't come to a solution how to handle such a case (it's also a breaking change) but IMHO comments are welcome.

In the end I also uninstalled the system-wide node, since it's not used.

@zachleat
Copy link

@ohana54 This did help me—thank you!

@chimurai
Copy link

chimurai commented Jan 9, 2019

nvm uninstall <old node version> did it for me. No need to temper with the symlinks

use nvm ls to list the installed node versions

@brettz9
Copy link

brettz9 commented Sep 18, 2019

I was getting the error message, "util.getSystemErrorName is not a function" (due to using an older Node version), and @chimurai's advice helped. Adding for anyone else who may come across that message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants