Skip to content

husky trying to open package.json #1631

@aschereT

Description

@aschereT

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.

  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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions