Aller au contenu principal
Version: 10.x

pnpm dlx

Aliases: pnpx is an alias for pnpm dlx

Récupère un package du registre sans l'installer en tant que dépendance, le charge, et exécute le binaire de commande par défaut qu'il expose.

For example, to use create-react-app anywhere to bootstrap a react app without needing to install it under another project, you can run:

pnpm dlx create-react-app ./my-app

This will fetch create-react-app from the registry and run it with the given arguments.

Vous pouvez également spécifier la version exacte du package que vous souhaitez utiliser :

pnpm dlx create-react-app@next ./my-app

Options

--package <name>

Le package à installer avant d'exécuter la commande.

Exemple:

pnpm --package=@pnpm/meta-updater dlx meta-updater --help
pnpm --package=@pnpm/meta-updater@0 dlx meta-updater --help

Plusieurs packages peuvent être fournis pour l'installation :

pnpm --package=yo --package=generator-webapp dlx yo webapp --skip-install

--allow-build

Added in: v10.2.0

A list of package names that are allowed to run postinstall scripts during installation.

Exemple:

pnpm --allow-build=esbuild my-bundler bundle

The actual packages executed by dlx are allowed to run postinstall scripts by default. So if in the above example my-bundler has to be built before execution, it will be built.

--shell-mode, -c

Runs the command inside of a shell. Uses /bin/sh on UNIX and \cmd.exe on Windows.

Exemple:

pnpm --package cowsay --package lolcatjs -c dlx 'echo "hi pnpm" | cowsay | lolcatjs'

--silent, -s

Seule la sortie de la commande exécutée est affichée.