pnpm: pnpm completion doesn't work in zsh
pnpm version: 6.32.3
Code to reproduce the issue:
pnpm install-completion zshexec zshpnpm <tab><tab>
Expected behavior:
pnpm should show completions when tabbing. It should show the completion for various flags in pnpm.
Actual behavior:
pnpm only gives completion for local files and nothing else. It doesn’t give completions for flags,subcommands,various packages,etc.

Additional information:
- I tried
pnpm install-completion bashand it worked. - I tried
pnpm install-completion fishand it worked. - I tried to do
pnpm install-completion zshwith empty.zshrcthinking it might be something to do with my ownzshconfiguration and it also didn’t work.
node -vprints: v16.14.0- Windows, macOS, or Linux?: Linux (5.16.14-1-MANJARO)
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 28
- Comments: 28 (5 by maintainers)
Ref to this thread: https://github.com/marlonrichert/zsh-snap/discussions/180#discussioncomment-3002906
pnpm uses a lib that generates these things for it but this lib imo does it wrong already. pnpm should just provide a zsh to load without requiring another lib/manager.
worked with
Ref: https://pnpm.io/completion
pnpm: v9.7.0 node: v22.6.0 os: Ubuntu 22.04
pnpm 8.6.12 zsh 5.9 (x86_64-pc-linux-gnu) node 20.5.1
pnpm install-completion zshdoes creates all files and all path are valid, however the auto completion does not work onpnpmneitherpnpm runI’ve managed to get it work by directly sourcing
pnpm.zshdirectly in the shell however the completion are the same forpnpmandpnpm runI would expect the
pnpm runcompletions to only autocomplete scripts in package.jsonThis does work as expected, the issue seems to be on your end.
Hey guys,
I was looking for better Zsh completions for pnpm myself, especially for package.json scripts - the way I had it setup for yarn - but couldn’t find anything satisfying. So, I went ahead and built a plugin to handle it. Check it out here: michakfromparis/zsh-pnpm-completions.
I threw a bunch of aliases and live npm package completion on top while at it.
Hope this helps you guys too! Let me know if this works for you.
Cheers,
@michakfromparis
I had the same issue (pnpm v10.1.0 installed via Homebrew), the
pnpm completion zshscript outputs the following:Which didn’t work for me since the output of the value assigned to the reply here
reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" SHELL=zsh pnpm completion-server -- "${words[@]}never matched the condition hereif [ "$reply" = "__tabtab_complete_files__" ]; thenas it only outputs the list of available commands and not__tabtab_complete_files__, see following video https://github.com/user-attachments/assets/06b47341-6a30-4c4f-9450-8682fc28fa4c.For this reason, I ended only seing “values” being shown as completions.
So I ended up making (a big word for making Claude Sonnet do the work) a custom completion script myself which works well enough for me right now, if you want to use it, replace the pnpm completion script with it (make sure to clear your zsh completion cache as well).
@zetlen Tried your plugin, didn’t work.
Have the same issue