Node.js

npm install --save-dev lefthook
yarn add --dev lefthook
pnpm add -D lefthook

Note: If you use pnpm package manager make sure you set side-effects-cache = false in your .npmrc, otherwise the postinstall script of the lefthook package won't be executed and hooks won't be installed.

Note: lefthook has three NPM packages with different ways to deliver the executables

  1. lefthook installs one executable for your system

    npm install --save-dev lefthook
    
  2. legacy1 @evilmartians/lefthook installs executables for all OS

    npm install --save-dev @evilmartians/lefthook
    
  3. legacy1 @evilmartians/lefthook-installer fetches the right executable on installation

    npm install --save-dev @evilmartians/lefthook-installer
    
1

Legacy distributions are still maintained but they will be shut down in the future.