#1631·husky

husky trying to open package.json

Author: aschereTCreated Jan 23, 2026Updated Jan 23, 2026

Troubleshoot

If you're migrating from husky 4, see: https://typicode.github.io/husky/migrate-from-v4.html

Context Husky tries to open package.json for some reason, even though my project is not a Node project.

javascript
 ❯ npx husky init                                                                                                                                                                                                                                                                                                   [13:25:55]
node:fs:555
  return binding.open(
                 ^

Error: ENOENT: no such file or directory, open 'package.json'
    at Object.openSync (node:fs:555:18)
    at Object.readFileSync (node:fs:439:35)
    at file:///Users/vincent.tan/.npm/_npx/0d92fdd791cc1044/node_modules/husky/bin.js:12:8
    at ModuleJob.run (node:internal/modules/esm/module_job:430:25)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:654:26)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: 'package.json'
}

Node.js v25.4.0

Thank you!