fork-dev / Tracker

Bug and issue tracker for Fork for Mac
511 stars 12 forks source link

lint failed without output (ENOENT). #1261

Open hhking opened 3 years ago

hhking commented 3 years ago

using ourselves lint tool with pre-commit and lint-staged,can't show the error message. lint failed without output (ENOENT).

but it work well with using VScode git tool or git command

DanPristupov commented 3 years ago

Start Fork from the terminal: https://github.com/fork-dev/Tracker/issues/1227#issuecomment-748522844

hhking commented 3 years ago

I try the open -a Fork .,and it can show the error message.

But i found fork not use the correct node version : husky > pre-commit (node v15.3.0)

in my terminal: node -v :v14.15.1

I use the nvm to manage the node version

DanPristupov commented 3 years ago

But i found fork not use the correct node version

Fork uses the environment of the parent process. So, in your case the environment of the terminal. Does 'which node' shows the correct node instance path?

hhking commented 3 years ago

Fork: (use open -a Fork . or not) /usr/local/Cellar/node/15.3.0

terminal: /Users/**/.nvm/versions/node/v14.15.1/bin

/usr/local/Cellar/node/15.3.0, this node version may installed by Homebrew and I uninstall it now. So Fork works well now if I Start Fork from the terminal. (but this way it not so convenience)

DanPristupov commented 3 years ago

this node version may installed by Homebrew and I uninstall it now.

It makes sense now. Yes, you are right. Fork adds /usr/local/bin to PATH (so it has a higher priority than what you have in the terminal).

but this way it not so convenience

Yes, but I don't know how to solve this.

infotexture commented 3 years ago

@DanPristupov Is there any way to add entries to the PATH Fork uses (without starting fork from the terminal)?

I'm running into a similar issue where my Husky pre-commit hooks are failing because they rely on npx, which is installed via Homebrew on M1 systems to /opt/homebrew/bin/npx, but this is not among the PATH entries that Fork.app uses.

klapec commented 3 years ago

Yup, experiencing the same on MacBook Pro M1 - npx is in /opt/homebrew/bin and thus npx lint-staged in the pre-commit hook fails.

Temporary (?) workaround: sudo ln -s /opt/homebrew/bin/* /usr/local/bin/

DanPristupov commented 3 years ago

I guess we need to add /opt/homebrew/bin to PATH in Fork on M1. Do you think this will solve the issue?

klapec commented 3 years ago

@DanPristupov yup, I think so. Is it possible for you to release a test/beta version with that change so that I could check it on my M1 macbook?

DanPristupov commented 3 years ago

@klapec yes, in ~30 minutes

DanPristupov commented 3 years ago

@klapec

The version which also includes /opt/homebrew/bin to PATH: https://cdn.fork.dev/prerelease/Fork-2.5.10.dmg

klapec commented 3 years ago

@DanPristupov Sorry for a late reply. It works, thanks! :)

infotexture commented 3 years ago

@DanPristupov Yep, tested here too, and can confirm it solves the problem. 🎉

DanPristupov commented 3 years ago

This change is part of the Fork 2.6 update.

patrick-fu commented 3 years ago

I am using Fork v2.6.5 in M1 Mac, but it still can’t find npx in commit hook, did you roll back the change of "added /opt/homebrew/bin to PATH" ?

DanPristupov commented 3 years ago

@patrick-fu ah, indeed. I forgot to merge the change into the release. I'm sorry :(.

Could you check if this version works for you? https://cdn.fork.dev/mac/Fork-2.6.6.dmg

patrick-fu commented 3 years ago

@patrick-fu ah, indeed. I forgot to merge the change into the release. I'm sorry :(.

Could you check if this version works for you? https://cdn.fork.dev/mac/Fork-2.6.6.dmg

Screen Shot 2021-04-13 at 2 31 55 PM

I tried reinstall 2.6.6 and restart system, but still not working, here's my .husky/commit-msg

#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

echo '🤡 We use `gitmoji` to standardize the commit message, see ./README.md !'

npx --no-install commitlint --edit

Is there something wrong with my config? thanks :)

DanPristupov commented 3 years ago
  1. Add echo $PATH to the hook and show the output, please
  2. Open terminal and show the output of which npx
patrick-fu commented 3 years ago
  • Add echo $PATH to the hook and show the output, please
  • Open terminal and show the output of which npx
$ git commit --file=/var/folders/44/vb4btgg57dv0zhmvh1tf1zcr0000gn/T/F5A526C2-93EA-4A68-A27E-9233ACE0B1B4

/Applications/Fork.app/Contents/Resources/git-instance/libexec/git-core:/Applications/Fork.app/Contents/Resources/git-instance/git-lfs:/Applications/Fork.app/Contents/Resources/gitflow-avh:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
🤡 We use `gitmoji` to standardize the commit message, see ./README.md !
.husky/commit-msg: line 8: npx: command not found
husky - commit-msg hook exited with code 127 (error)
➜  ~ which npx
/opt/homebrew/bin/npx
➜  ~ 
DanPristupov commented 3 years ago

@patrick-fu thank you for the details. You are right.

I mistakingly changed the path of the custom commands instead of git commands. I'm very surprised the 2.5.10 version above worked, because it must have not.

Anyway, I've made a new 2.5.7 build which must work correctly: https://cdn.fork.dev/mac/Fork-2.6.7.dmg. I can't test it myself because I don't have brew on my m1 machine, but I do see the /opt/homebrew/bin in the PATH.

patrick-fu commented 3 years ago

@DanPristupov 🎉 v2.6.7 solved the problem, thank you so much 🥰