NPM package

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

If you use pnpm package manager make sure to update pnpm-workspace.yamls onlyBuiltDependencies with lefthook and add lefthook to pnpm.onlyBuiltDependencies in your root package.json, otherwise the postinstall script of the lefthook package won’t be executed and hooks won’t be installed.

Choose right package

Lefthook supports three NPM packages with different ways to deliver the executables

  1. lefthook installs one executable for your system

    npm install --save-dev lefthook
    
  2. legacy[1] @evilmartians/lefthook installs executables for all OS

    npm install --save-dev @evilmartians/lefthook
    
  3. legacy[1:1] @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. ↩︎ ↩︎