メインコンテンツまでスキップ
バージョン: 10.x

pnpm dlx

Aliases: pnpx is an alias for pnpm dlx

依存関係としてパッケージをインストールするのではなく、レジストリから取得し、ホットロードして、そのパッケージが公開するデフォルトのコマンドバイナリを実行します。

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.

使用するパッケージの正確なバージョンを指定することもできます。

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

Options

--package <name>

コマンドを実行する前にインストールするパッケージを指定

例:

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

インストール用に複数のパッケージを利用できます

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.

例:

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

シェル内でコマンドを実行します。 Uses /bin/sh on UNIX and \cmd.exe on Windows.

例:

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

--silent, -s

実行されたコマンドの出力のみが出力されます。