Open chunghaw-tsengfang opened 2 years ago
@chunghaw-wevnal Sorry you're running into issues! Can you clarify a bit the setup for this project and what command you were running? As far as I can tell, there weren't any changes to resolution behavior between Volta 1.0.4 and 1.0.5, so I'm not sure how this specifically would break between the two.
We've also tested with Husky and seen it work, so I suspect this might be a little trickier to debug.
Finally, can you share the contents of the log file described in the error message? It may not be super instructive, but it should help us better understand what Volta is seeing (or not seeing).
@charlespierce Hello, I have a same problem. Volta version: 1.0.5 Husky version: 7 Hardware: macOS Monterey Git client tool: Fork
When I try to do a commit using the Git client software called Fork, I get the following error message.
$ git commit --file=/var/folders/kx/_fmnlj9j3kv7bsjqf08jskf80000gn/T/BC00096D-526E-4A67-B678-F3081180CC70
.husky/pre-commit: line 4: yarn: command not found
husky - pre-commit hook exited with code 127 (error)
This seems to be due to the different PATH, as stated on Husky's official website.
https://typicode.github.io/husky/#/?id=command-not-found
If you're running Git from an app and the command can be found in your terminal, this means that the PATH in your app is different from your terminal.
To solve this, I need to put the PATH of yarn in .huskyrc
, but I don't know how to write it validly in volta.
The official site described how to write for nvm, so it would be great to know the volta version of this.
This is a nvm version
# ~/.huskyrc
# This loads nvm.sh and sets the correct PATH before running hook
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
Had a similar problem when using vscode git UI. This worked for me:
# ~/.huskyrc
export PATH=$PATH:~/.volta/bin
@thinksentient Thank you for reply, it worked for me!!
Git GUI clients usually run the git commands in an non-interactive shell, which in the case of zsh means that ~/.zshrc isn't sourced. So volta setup
should be changed to targeting either .zshenv or .zprofile instead.
I had this issue even with a .huskyrc
. The husky error output would print its PATH
and I could clearly see my /Users/me/.volta/bin
in there, and it still couldn't find it.
In my case I was using a terminal so I just closed that window and opened a new one - worked fine 🤷
Issue
Problem
Running volta 1.0.5 and husky. On husky pre-commit, volta seems not to be able to find node. We have set the paths and even pinned the versions on the huskyrc file on top of the normal project. This problem only happens on 1.0.5 and not on 1.0.4.
Volta version: 1.0.5 Husky version: 7 Hardware: Mac OS Big Sur
Error