I'm facing issues with getting husky
and lint-staged
to function properly on my Windows 10 system.
Here's how my setup looks like:
.huskyrc.json
{
"hooks": {
"pre-commit": "lint-staged"
}
}
.lintstagedrc (content seems irrelevant as the problem arises before this file is even read)
{
"**/*.+(js|md)": [
"prettier --write",
"eslint --fix src/",
"git add"
]
}
package.json
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --watchAll=false",
"eject": "react-scripts eject",
"lint": "eslint .",
"lint-fix": "eslint . --fix"
},
...
"devDependencies": {
...
"husky": "^4.3.0",
"lint-staged": "^10.5.4",
...
}
My npm version is 6.14.11 and node version is 14.15.1.
When I run git add .
and git commit -m "test"
in the terminal, here's the error message I encounter:
husky > pre-commit (node v14.15.1)
C:\Program Files\nodejs/node_modules/node/bin/node: line 1: This: command not found
husky > pre-commit hook failed (add --no-verify to bypass)
This issue seems to be occurring only on my Windows machine and not on Ubuntu. Any insights on what could be causing this?