VSCode & FNM - pre-commit: npx: not found

Viewed 284

I'm using VSCode and FNM (Fast Node Manager) instead of NVM. The issue seems to be that VSCode fails to see npx while committing from Source Control and throws out the following error:

> git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file -
.husky/pre-commit: 6: npx: not found
husky - pre-commit hook exited with code 127 (error)

I've looked at other answers here and they all seem to be pointing towards a misconfigured path for NVM but I'm currently not using NVM. I'm on fnm: https://github.com/Schniz/fnm

Is there any way I can fix this?

1 Answers

I had the same problem after switching from nvm. Try to add eval "$(fnm env --use-on-cd)" in your .zshrc file.

For me it was the solution. Maybe it helps you as well.

Related