跳至主要內容
版本: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

--shell-mode, -c

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

例如:

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

--silent, -s

Only the output of the executed command is printed.