CLI doens't work with `npx` / `yarn dlx` (`could not determine executable to run`)
Author: barjinCreated Jul 14, 2026Updated Jul 14, 2026
The documented CLI usage through npx doesn't work, as npm / yarn cannot determine the right executable to run:
This is likely due to having multiple bin fields in @napi-rs/cli/package.json:
"bin": {
"napi": "./dist/cli.js",
"napi-raw": "./cli.mjs"
},You can clear this discrepancy by calling npx -p @napi-rs/cli napi:
See that v2 napi CLI had only one bin script, so running it through npx works just fine:
Source: napi-rs/napi-rs