The pnpm
package manager offers three commands that are alternatives for npm
's npx
command. These are pnpm create
, pnpx
and pnpm dlx
. All three seem to do the same thing. But what are the differences between them? Which one should be preferred for which tasks? Or is there a universal best?
Asked
Active
Viewed 9,763 times
13

Arctomachine
- 401
- 6
- 12
-
See also [Can I use npx with pnpm?](https://stackoverflow.com/questions/75413361/can-i-use-npx-with-pnpm) – cachius Jun 28 '23 at 07:06
1 Answers
25
As of v7, pnpm dlx
is the same as pnpx
. It downloads a package and executes it.
pnpm create
is a shorthand for pnpm dlx
, when you need to create an app. So, for instance, pnpm create react-app my-app
will download the create-react-app
package and run it to bootstrap a react app. It is the same as running pnpm dlx create-react-app my-app
.
There is also pnpm exec
, which doesn't download a package just runs a package that is already in node_modules/.bin

Zoltan Kochan
- 5,180
- 29
- 38
-
1So technically they are just one and the same command with different syntax? And the preferred syntax is the one I personally like the most? – Arctomachine Aug 20 '22 at 18:15
-
`pnpm dlx` and `pnpx` are the same. `pnpm create` does some additional stuff as I mentioned. It changes the package name that should be downloaded. – Zoltan Kochan Aug 21 '22 at 11:24
-
Note that pnpx is [deprecated](https://pnpm.io/6.x/pnpx-cli). Use pnpm dlx instead – hiru007 Feb 02 '23 at 16:51
-
but pnpm dlx seems to have an issue with parameters? I was trying to install prisma using pnpx prisma init -datasource=provider sqlite and got the "deprecated" with pnpm exec or pnpm dlx. Of course exec wont work but pnpm dlx prisma init -datasource=provider sqlite wouldnt work either as it cant use a parameter?? I ran without parameter and adjusted files manually. I then ran into another issue where I want "prisma": { "seed": "pnpm dlx vite-node prisma/seed.ts" in package.json. It appears to run but I get no data. Is there a solution for passing parameters? – Pick Avana Mar 10 '23 at 01:48
-
-
npx works like both `pnpm dlx` and `pnpm exec`. If it find a locally installed command, then it executes it, if it does find it, then it downloads and executes it. – Zoltan Kochan May 07 '23 at 09:01
-
but I dont understand what's the 'p' infront of pnpm and pnpx means. What's the difference between p infront and without ? Thanks. – EBDS Aug 10 '23 at 02:28