I recently updated the dependencies on my React Native project, and we have husky
pre-coomit hooks set up. I tried committing now and I get the following error:
myname@MacSelf014 my-project % git commit --amend
file:///<path-to-project>/node_modules/listr2/dist/index.js:206
this.options.fields ??= {};
^^^
SyntaxError: Unexpected token '??='
at Loader.moduleStrategy (internal/modules/esm/translators.js:149:18)
husky - pre-commit hook exited with code 1 (error)
The pre-commit set up looks like this in my package.json
:
"lint-staged": {
"*.{js,ts,tsx}": [
"eslint --fix",
"prettier --write",
]
I've tried adding node_modules
to .husky/_/.gitignore
like so:
*
node_modules/*
And the problem persists. Any idea what the issue might be?
The problem isn't your linters, it's the listr2 package that husky uses to make nice console messages. It's probably your node version.
Check your node version in the terminal you used to make your commit with
node -v
and make sure yout have at least v16.Sources :