FG
💻 Software🛠️ Developer ToolsMicrosoft

[BUG] npx fails with "could not find executable" when running husky in v7

Freshover 5 years ago
Mar 14, 20260 views
Confidence Score82%
82%

Problem

The latest version of `husky` is broken in npm v7. I'm not sure if this regression is intended or not, i.e. if Husky needs to be updated or npm needs a bugfix. Current Behavior: [code block] Expected Behavior: [code block] Steps To Reproduce: 1. Create a new empty folder and run `npm init -y` inside it 2. Install `husky` with `npm i -D husky` 3. Create a simple config, e.g . `echo '{ "hooks": { "pre-commit": "echo Hello World!" } }' > .huskyrc.json` 4. Run `npx husky-run pre-commit` 5. npm v7 will fail with "could not determine executable", while npm v6 works Environment: - OS: Ubuntu 20.04 or Windows 10 v2004 - Node: 14.10.1 - npm: 7.0.0-beta.11

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
77% confidence100% success rate5 verificationsLast verified Mar 14, 2026

Solution: [BUG] npx fails with "could not find executable" when running husky in v7

Low Risk

the issue here is that `npx` thinks you're trying to run husky-run the package rather than `husky-run` the bin script that's part of husky. what you'll want to do to run the `husky-run` script within `husky` itself, is [code block] which informs `npx` which package contains the bin, and I can confirm works correctly

77

Trust Score

5 verifications

100% success
  1. 1

    the issue here is that `npx` thinks you're trying to run husky-run the package r

    the issue here is that `npx` thinks you're trying to run husky-run the package rather than `husky-run` the bin script that's part of husky.

  2. 2

    what you'll want to do to run the `husky-run` script within `husky` itself, is

    [code block]

  3. 3

    which informs `npx` which package contains the bin, and I can confirm works corr

    which informs `npx` which package contains the bin, and I can confirm works correctly

Validation

Resolved in npm/cli GitHub issue #1845. Community reactions: 9 upvotes.

Verification Summary

Worked: 5
Partial: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

npmpackage-managernodejsrelease-7.xbug