Node.js
Node.js
npm install --save-dev lefthook
yarn add --dev lefthook
pnpm add -D lefthook
Note: If you use
pnpmpackage manager make sure to updatepnpm-workspace.yamlsonlyBuiltDependencieswithlefthookand addlefthooktopnpm.onlyBuiltDependenciesin your rootpackage.json, otherwise thepostinstallscript of thelefthookpackage won’t be executed and hooks won’t be installed.
Note: lefthook has three NPM packages with different ways to deliver the executables
lefthook installs one executable for your system
npm install --save-dev lefthooklegacy[1] @evilmartians/lefthook installs executables for all OS
npm install --save-dev @evilmartians/lefthooklegacy[1:1] @evilmartians/lefthook-installer fetches the right executable on installation
npm install --save-dev @evilmartians/lefthook-installer