Skip to content

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

@csvn

Description

@csvn

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:

~ npx husky-run pre-commit
npm ERR! could not determine executable to run

npm ERR! A complete log of this run can be found in:
...

Expected Behavior:

~ npx husky-run pre-commit
husky > pre-commit (node v14.10.1)
Hello World!
...

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

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingRelease 7.xwork is associated with a specific npm 7 release

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions