husky: V9 doesn't work after install

Basically what I did:

npm install --save-dev husky

and then:

npx husky init

file:///Users/.../project/node_modules/husky/bin.js:10
  ;(d.scripts ||= {}).prepare = 'husky'
              ^^^

SyntaxError: Unexpected token '||='
    at Loader.moduleStrategy (internal/modules/esm/translators.js:149:18)
    at async link (internal/modules/esm/module_job.js:67:21)

Troubleshoot

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

Context

  • OS X, normal OSX terminal

About this issue

  • Original URL
  • State: closed
  • Created 5 months ago
  • Reactions: 3
  • Comments: 15 (7 by maintainers)

Commits related to this issue

Most upvoted comments

And thanks for the details, I’m still not sure why there’s a syntax error

Replace it with husky. No need for npx or install anymore