skip to content
Just Change Direction

How to fix pnpm command not found in VSCode with Git, Husky and Mise

/ 1 min read

Ever ran into the error “pnpm: command not found” when committing inside the VSCode source control?

Error message

Here is a fix:

This article has an explanation of the issue, however, the process is a little different for Mise. To fix it, I needed to do the following:

  • Run mise activate —shims to output the path to the Mise shims
  • Create a Husky init file ~/.config/husky/init.sh
  • Add the shims path to it:
#!/bin/sh
export PATH="/Users/<your-user-name>/.local/share/mise/shims:$PATH"

Despite not understanding what most of the above words mean, it now seems to work for me 🎉

Update: I ran into another similar error. This time, it was because the node and pnpm versions were different when running a script versus in the terminal.

This was because of a global pnpm setting that was overidding the mise versions that I had installed.

To fix this, I had to go to the global pnpm settings found at ~/Library/Preferences/pnpm/rc (for a Mac) and remove the use-node-version and use-pnpm-version settings.

Working out what the issue was took me the best part of a day, so hopefully this will help someone else.