Since my package.json and .git are not on the same level, I referred to the custom directory of the docs.
error
yarn run v1.22.17
error Couldn't find a package.json file in "/Users/home/project"
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
husky - pre-commit hook exited with code 1 (error)
directory structure
project
│ .git
│
└─── admin
│ │
│ └───frontend(using js and React)
│ │ package.json
│ └─── .husky
│ │
│ └───backend(using js and Node.js)
└─── engine(using Rust)
package.json
"devDependencies": {
...
"husky": "^8.0.1",
"lint-staged": "^13.0.3",
},
"scripts": {
"start": "webpack serve --progress --mode development",
"build": "webpack --progress --mode production",
"prepare": "cd ../.. && husky install admin/frontend/.husky && husky add admin/frontend/.husky/pre-commit \"yarn run lint-staged\""
},
"lint-staged": {
"**/*.{js, jsx, ts, tsx}": [
"prettier --write",
"eslint --fix"
]
}
But when I git commit, I get the above error. how can i fix it?