I have an issue installing husky (with lint-staged) for a while now and I would very much appreciate any help. My project setup is: node JS, npm with eslint, prettier set-up and now trying to add husky with lint-staged.
THE MAIN ISSUE:
When installing husky "npm install husky --save-dev" the pre-commit file (in ".git/hooks" folder) is not being modified with Husky code! The installation message:
husky > Setting up git hooks
Cannot read property 'toString' of null
husky > Failed to install
System details: OS: Windows 10 Git: git version 2.28.0 node -v v12.16.1 husky: 4.2.5
I have tried the following: (1 Git is registered as an env PATH variable (2 There is no hooksPath set in the global gitconfig file that would point to another directory than .git/hooks in the local workspace (3 Installing/uninstalling Husky (4 Making the pre-commit file executable by removing .sample (5 Deleting .git/hooks/pre-commit file altogether (6 Adding the necessary script in the "package.json" file as below
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"src/**/*.js": "eslint --fix",
"*.{html,md,json}": "prettier --write"
}
I have still no luck.
As a consequence, when committing changes, husky does NOT run at all!
Thanks for any help in advance!