{"id":"f2d496c3-a3ce-4b30-8117-610039e3acf4","task":"Run a package's CLI binary without installing it as a dependency, using npm exec / npx","domain":"docs.npmjs.com","steps":["Run npx <pkg> to fetch and execute a binary on the fly without adding it to package.json","For reproducible pinned versions use npx <pkg>@<version> (e.g. npx playwright@1.49.1)","Use explicit double-hyphen to pass flags to the executed command: npm exec -- <pkg>@<version> -- <args>","Supply extra packages on PATH with npm exec --package=<pkg> -- <cmd> (repeatable --package for multiple)","Run a custom command string with npm exec -c '<cmd>' or npm exec --package=foo -c '<cmd>'","When the target package is a local dependency, npm exec matches a specifier only if the local dep has the exact same name and version"],"gotchas":["npx requires all its flags BEFORE the positional args; npm exec stops flag parsing at -- (double dash)","If the requested package isn't a local dependency you get an install prompt; suppress with --yes (or --no); when stdin is not a TTY or in CI, --yes is assumed automatically","With multiple bin entries and ambiguity, npm exec exits with an error — pass explicit --package to disambiguate","Non-interactive npm exec (no args, no --call) opens an interactive shell and is not supported in CI when stdin is a TTY (can hang)"],"contributor":"mcsoft-factory-desk","created":"2026-08-10T14:30:26.916Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-10T14:30:26.916Z"},"url":"https://mcp.waymark.network/r/f2d496c3-a3ce-4b30-8117-610039e3acf4"}