GithubHelp home page GithubHelp logo

can't uninstall about pre-commit HOT 11 OPEN

observing avatar observing commented on August 22, 2024 10
can't uninstall

from pre-commit.

Comments (11)

evannieuwburg avatar evannieuwburg commented on August 22, 2024 2

npm uninstall removes the node modules, but doesn't uninstall the git hooks in you '.git/hooks' folder, so that hook keeps referencing the already removed node module. It would be nice of this module had a 'reset-hooks' method or something.

from pre-commit.

avdeev avatar avdeev commented on August 22, 2024 1

Solution - remove all previous hooks

rm .git/hooks/pre-commit

from pre-commit.

keval-r-7span avatar keval-r-7span commented on August 22, 2024 1

go to .git folder and remove hook folder and then solve your issue

from pre-commit.

3rd-Eden avatar 3rd-Eden commented on August 22, 2024

How did you remove the dependency?

from pre-commit.

eviazmensky avatar eviazmensky commented on August 22, 2024

I ran npm uninstall pre-commit --save-dev

from pre-commit.

3rd-Eden avatar 3rd-Eden commented on August 22, 2024

In that case, i'm guessing that our uninstall script needs to updated for proper un-installation. Thanks for the heads up.

from pre-commit.

przhkv avatar przhkv commented on August 22, 2024

Had the same issue. In my case probably yarn install somehow skipped uninstall script 😕
To cancel old hook I manually replaced .git/hooks/pre-commit with .git/hooks/pre-commit.old

from pre-commit.

Tatsujinichi avatar Tatsujinichi commented on August 22, 2024

+1

from pre-commit.

AndrewSouthpaw avatar AndrewSouthpaw commented on August 22, 2024

For whatever reason mine got messed up as well. You can rm .git/hooks/pre-commit, but I just did

yarn add pre-commit
yarn remove pre-commit

and that got it back to working condition (and restored my old hooks, which the previous solution does not do).

from pre-commit.

WillGibson avatar WillGibson commented on August 22, 2024

I ran into trouble here when we decided to change from pre-commit to pre-push.

I might be wrong, but I think the issue might be that the uninstall removes the pre-commit hook on the machine of the person doing the uninstalling, but not other people who may already have the code checkout out with the hook in place, but now referencing a module which no longer exists.

It's mildly annoying to have to leave pre-commit installed to avoid this problem, but the original poster's suggestion seems to be the least workflow disrupting solution for now.

from pre-commit.

devinrhode2 avatar devinrhode2 commented on August 22, 2024

This could be added to the readme:

#!/usr/bin/env sh

[[ -f .git/hooks/pre-commit ]] && {
  echo 'De-activating old git hook (.git/hooks/pre-commit), by renaming to `.git/hooks/pre-husky-pre-commit-hook`'
  echo 'The old hook does not work, because `node_modules/pre-commit` has been replaced with husky'
  echo 'If you want to run eslint pre-commit, simply `yarn run activate-git-hooks`'
  echo 'Feel free to add other scripts to .husky/pre-commit under an opt-in flag.'
  echo 'You can also keep husky deactivated, and simply put anything you want in your `.git/hooks/pre-commit` file'
  echo 'Activating/deactivating husky does not modify .git/hooks directory.'
  echo 'It modifies .git/config core.hooksPath to point to .husky/ directory instead of using .git/hooks directory.'
  mv .git/hooks/pre-commit .git/hooks/pre-husky-pre-commit-hook
}

You can run this in a postinstall hook.

Name the file something like ./scripts/cleanup-old-pre-commit-hook.sh and call this in your postinstall script:

"posinstall": "./scripts/cleanup-old-pre-commit-hook.sh",

from pre-commit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.