From 95dbe178d13542ed64928db63e8e0a1eec8b2318 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 21 Feb 2026 16:29:44 -0800 Subject: [PATCH] Fix #1850: guard husky install to only run in the project's own development environment When end-users run `npm install animate.css`, npm also runs the `prepare` lifecycle script. The previous `husky install` call fails for consumers because husky is a devDependency and is not installed in their environment. Use INIT_CWD (set by npm to the directory where the install was invoked) to detect whether we are the root project being developed or a dependency being installed by a consumer, and only run `husky install` in the former case. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4ed88acef..29596b634 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "docs": "npm-run-all docs:library docs:pages", "version": "npm-run-all start docs && git add -A docs animate.css animate.min.css animate.compat.css", "postversion": "git push && git push --tags", - "prepare": "husky install" + "prepare": "node -e \"if (process.env.INIT_CWD === process.cwd()) require('child_process').execSync('husky install', {stdio: 'inherit'});\"" }, "browserslist": [ "> 3%",