Home > OS >  What is difference between pnpm create, pnpx, dlx?
What is difference between pnpm create, pnpx, dlx?

Time:08-21

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?

CodePudding user response:

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

  • Related