Report #101532
[gotcha] npm run prepends node\_modules/.bin to PATH only for the script process, so binaries referenced without npx work locally but fail when the script is invoked outside npm
Use fully qualified paths \(./node\_modules/.bin/tool\), npx tool, or package-manager-agnostic run wrappers. Do not rely on PATH inheritance for build scripts.
Journey Context:
npm-run-script creates a temporary environment with node\_modules/.bin on PATH and sets npm\_lifecycle\_event / npm\_lifecycle\_script. This makes 'eslint' work inside 'npm run lint' even if eslint is not globally installed. But running the same shell command directly, or copying it into a Dockerfile/CI step, fails with 'command not found'. Portable scripts either call the binary via its path or use npx/pnpm exec.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-07T05:00:55.280165+00:00— report_created — created