tarmolov / git-hooks-js

A tool to manage and run project git hooks
167 stars 30 forks source link

How to reinstall git-hooks with yarn? #61

Closed gitowiec closed 4 years ago

gitowiec commented 6 years ago

I changed my project folder and path to .git/hooks grew with one path segment. Now sources of every file in .git/hooks are outdated, there is a line with wrong path:

require('/home/george/workspace/document-template/node_modules/git-hooks/lib/git-hooks').run(__filename, process.argv.slice(2), function (code, error) {

When I trigger my hook with git commit I get

GIT-HOOKS ERROR] Cannot find module '/home/george/workspace/document-template/node_modules/git-hooks/lib/git-hooks'
[GIT-HOOKS ERROR] Please reinstall git-hooks to fix this error
[GIT-HOOKS ERROR] Cannot find module '/home/george/workspace/document-template/node_modules/git-hooks/lib/git-hooks'
[GIT-HOOKS ERROR] Please reinstall git-hooks to fix this error
[GIT-HOOKS ERROR] Cannot find module '/home/george/workspace/document-template/node_modules/git-hooks/lib/git-hooks'
[GIT-HOOKS ERROR] Please reinstall git-hooks to fix this error
[GIT-HOOKS ERROR] Cannot find module '/home/george/workspace/document-template/node_modules/git-hooks/lib/git-hooks'
[GIT-HOOKS ERROR] Please reinstall git-hooks to fix this error

I run:

  1. yarn
  2. deleted yarn.lock and called yarn
  3. yarn install --check-files
  4. yarn install --force

Nothing helped What to do?

shiftj2019 commented 4 years ago

https://github.com/yarnpkg/yarn/issues/5476#issuecomment-392995377 node v8.12.0 yarn 1.13.0. scripts postinstall of yarn is ok on my device. '.git/hooks' has been inited.

patrik-csak commented 4 years ago

I had this problem as well. I fixed it with:

node_modules/git-hooks/bin/git-hooks --uninstall && node_modules/git-hooks/bin/git-hooks --install