-
Notifications
You must be signed in to change notification settings - Fork 12
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
Pre-commit hook can't find node #311
Comments
It looks like Fork doesn't have node in PATH in ENV. |
I suppose I can close this |
This is still an issue for me. When using Node Version manager, fork can't seem to find the npm executable. |
@nicekiwi did you try to start Fork from terminal as I mentioned in my comment? Where is |
@DanPristupov yeah it does work starting form command line.
|
Well, I understand that the problem isn't trivial, but this isn't much elegant solution for the problem.
I'd understand this behaviour when using bundled Fork git instance, but the system git instance should be equivalent to typing |
No, things in OS don't work like that. In *nix (including BSD, including macOS) a process inherits environment of the parent process. The environment of your shell is available only for that shell process or the processes which it started. Fork (or any other process started from Dock or Spotlight) doesn't have an access to it. |
I understand how OS works and what process tree is, I was just stating what the end user would expect to happen when clicking commit in Fork, while using git hooks.
… On 12 Nov 2020, at 18:34, Dan ***@***.***> wrote:
I'd understand this behaviour when using bundled Fork git instance, but the system git instance should be equivalent to typing git into my default shell.
No, things in OS don't work like that. In *nix (including BSD, including macOS) a process inherits environment of the parent process. The environment of your shell is available only for that shell process or the processes which it started. Fork (or any other process started from Dock or Spotlight) doesn't have an access to it.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
I'm facing a similar issue. Fork is using a different node version than my project so then when running the tests with hooks they do not pass (They crash because of the node version). Any suggestion guys? |
@McFlyssss Start Fork from the terminal using |
typicode/husky#390 (comment) This worked fine for me, none of the existing solutions didn't help. They just change nothing. |
You can also symbolic link your npm installation to one of the directories listed in |
I always start fork from my terminal and it's still using the wrong version for me. Any other ideas? I tried
Attempting to commit through fork gives:
Full disclosure: I'm not super familiar with macs. |
@msgirlperl |
this worked for me on mac, for example:
|
@jogly thanks, works perfectly and avoids having to mess with starting Fork some complicated way other than a dock icon |
This comment resolved the issue for me: typicode/husky#390 (comment) If you use a node version manager, basically, create For fnm it's:
|
I had a homebrew node installation conflicting with my fnm version node manager somehow. |
This ended up working for me (husky git hooks): In the repo's
|
Still running into this in 2024. Besides my previous answer (symbolic link to /bin folder, which by the way, also fixes some XCode errors if you are using React Native or some other framework that uses node), the solutions by hook managers like Husky or LeftHook is an rc file. Here is the documentation for LeftHook RC File |
Thanks for this. FYI, I got an error with husky@9.1.7 that |
Hey there,
I'm using husky to run a pre-commit hook on my repo, and everything runs correctly in my terminal when I run
git commit -m "some message"
The issue is when I try and commit with Fork, and it attempts to run the pre-commit hook and fails because it can't find
node
. Here's the full error from Forkwhen I run
which node
I get/Users/brandon/.nvf/installed/node-8.5.0/bin/node
Full disclosure I'm using macOS, with fish shell, and nvf to manage my node versions. I just really wonder how Fork is running the pre-commit in a way where it can't find my node installation. Let me know if you have any questions or need more info.
The text was updated successfully, but these errors were encountered: