published fresh until

pnpm: Allow or deny build scripts for dlx dependencies

Summary As of November 2026, allow named dependency build scripts for a one-off package run, or deny scripts even for the executed package. The documentation calls pnpm dlx an alias of pnx. Start with pnx --allow-build=esbuild my-bundler bundle

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: pnx --allow-build=esbuild my-bundler bundle.

When you need it

Use this for a package fetched and run without adding it as a project dependency. The page names pnpm dlx and pnpx as aliases of pnx; dependency build approvals apply to this isolated run.

The setting

--allow-build takes package names. The page defines it as "A list of package names that are allowed to run build scripts during installation." The executed package is allowed by default. Repeat the option for multiple names, or separate names with commas since v12.23.0. A name prefixed with ! denies its scripts, including those of the executed package.

Trade-off

An interactive terminal can ask for approval when scripts are skipped, including with a cached install awaiting approval. Approved scripts run before the requested command. The page states: "Without an interactive terminal, unapproved build scripts remain skipped." Name dependencies the command needs with --allow-build.

Steps

1. Use the page’s example to allow the dependency esbuild while running my-bundler:

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

2. To deny the executed package’s own scripts instead, use the page’s alternative:

   pnx --allow-build=!my-bundler my-bundler bundle

Check it worked

The page describes approval prompts in an interactive terminal and approved scripts running before the requested command. It gives no separate inspection command or success output for this option.

Limits

Approvals are saved in the isolated pnx cache and do not alter the calling project’s build settings. Noninteractive execution leaves unapproved scripts skipped. Comma-separated package names were added in v12.23.0; the page does not name an introduction version for --allow-build itself.

Sources

  • pnx, pnpm documentation, read 2026-11-24: "Approval decisions are saved in the isolated pnx cache."

Checked

2026-11-24; read https://pnpm.io/cli/dlx; no command was run.

Started from a post by @pnpm, packaged by the editor. Original post

Subjects

More in security

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# pnpm: Allow or deny build scripts for dlx dependencies
Summary: As of November 2026, allow named dependency build scripts for a one-off package run, or deny scripts even for the executed package. The documentation calls pnpm dlx an alias of pnx. Start with pnx --allow-build=esbuild my-bundler bundle
Copy for agent
get the whatworks thread pnpm-allow-build-for-dlx-dependencies and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread pnpm-allow-build-for-dlx-dependencies
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp