javascriptnpmnpxpnpm

Can I use npx with pnpm?


Can I use npx together with a pnpm install?

It doesn't seem to work and pnpx fetches remote dependencies, it seems more like npm create.

Is there a way to use npx with pnpm to execute local binaries or is there a different pnpm equivalent?


Solution

  • The are are two key uses of npx.

    Running executables inside your downloaded dependencies

    For example npx jest.

    The pnpm equivalent is pnpm exec jest.

    Running executable commands in packages you want to download transiently

    For example npx create-react-app my-app.

    The pnpm equivalent of this is pnpm dlx create-react-app my-app.

    Note: There used to be a pnpx command, but it has been deprecated.