Pre-commit / hook: no such file or directory

I get this error when I try to commit.

OS is the latest OSX

Git version - git version 2.11.0 (Apple Git -81)

.git/hooks/pre-commit: line 2: ./node_modules/pre-commit/hook: No such file or directory
+21
source share
3 answers

pre-commit hook starts first when you try to commit changes, it can be used to perform certain checks, tests, conditions. In this case, obviously, you don’t have one, so he complains.

Go to the directory .git/hooksand delete the file pre-commitas it is trying to link to node_modules/pre-commit/hook. That should decide.

Another option is to add a commit with the option:, --no-verifyit will commit without checking.

+37

node_modules npm install yarn install. , , .

+5

I had this error, someone removed the following from package.json

 "pre-commit": [
    "lint"
  ],

(not sure if this will help anyone!)

0
source

Source: https://habr.com/ru/post/1017197/


All Articles