pnx
Aliases: pnpm dlx, pnpx
Получает пакет из реестра, не устанавливая его в качестве зависимости, загружает его и запускает любой бинарный файл назначенный как команда по умолчанию у пакета.
For example, to use create-vue anywhere to bootstrap a Vue project without
needing to install it under another project, you can run:
pnx create-vue my-app
This will fetch create-vue from the registry and run it with the given arguments.
Вы также можете указать, какую именно версию пакета вы хотите использовать:
pnx create-vue@next my-app
The catalog: protocol is also supported, allowing you to use versions defined in your workspace catalogs:
pnx shx@catalog:
Опции#
--package <name>#
Пакет для установки перед выполнением команды.
Пример:
pnx --package=@pnpm/meta-updater meta-updater --help
pnx --package=@pnpm/meta-updater@0 meta-updater --help
Для установки могут быть предоставлены несколько пакетов:
pnx --package=yo --package=generator-webapp 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.
Пример:
pnx --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.
Prefixing a name with ! denies its postinstall scripts, including for the executed package itself:
pnx --allow-build=!my-bundler my-bundler bundle
--shell-mode, -c#
Runs the command inside of a shell. Uses /bin/sh on UNIX and \cmd.exe on Windows.
Пример:
pnx --package cowsay --package lolcatjs -c 'echo "hi pnpm" | cowsay | lolcatjs'
--minimum-release-age <minutes>, --minimum-release-age-exclude <package-spec>#
Added in: v11.28.14
Set minimumReleaseAge and minimumReleaseAgeExclude for this run, as they do for pnpm install.
--silent, -s#
Only the output of the executed command is printed.
Security and trust policies#
Since v11.0.0, pnx (and its pnpm dlx / pnpx aliases) honors the project-level security and trust policy settings when resolving and fetching the requested package:
minimumReleaseAge,minimumReleaseAgeExclude,minimumReleaseAgeStricttrustPolicy,trustPolicyExclude,trustPolicyIgnoreAfter
This means pnx will refuse to execute freshly published or insufficiently trusted packages the same way a regular pnpm install would.
pnx ignores other project-local execution, hook, and directory settings in the current directory (pnpmfile, globalPnpmfile, configDependencies, scriptShell, cacheDir, storeDir, ignoreScripts, overrides, packageExtensions, and patchedDependencies), while keeping user-level global configuration active.