Published on

How to use PNPM for npx


I've started using pnpm package manager recently. And noticed that whenever I use npx it uses npm instead.

After a little digging, I came across npm_execpath environment variable using which we can configure the path for npx

And here is how to do it.

Configuration this in your ~/.zshrc or ~/.bashrc based on the shell that you're using.

alias npx="npm_execpath=$(which pnpm) npx"

Happy PNPM-based npx!