From a489ff84bd1aa23332800019aa5d09447d5123e8 Mon Sep 17 00:00:00 2001 From: Yejun Su Date: Thu, 30 Apr 2026 23:10:37 +0800 Subject: [PATCH] fix install npm error command sh -c husky Error: npm install --omit=dev failed with code 127 --- .husky/install.mjs | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .husky/install.mjs diff --git a/.husky/install.mjs b/.husky/install.mjs new file mode 100644 index 0000000..920bd55 --- /dev/null +++ b/.husky/install.mjs @@ -0,0 +1,6 @@ +// Skip Husky install in production and CI +if (process.env.NODE_ENV === "production" || process.env.CI === "true") { + process.exit(0); +} +const husky = (await import("husky")).default; +console.log(husky()); diff --git a/package.json b/package.json index bdbc469..e5def63 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "scripts": { "lint": "biome check --write .", "lint:check": "biome check .", - "prepare": "husky" + "prepare": "node .husky/install.mjs" }, "devDependencies": { "@biomejs/biome": "^2.4.12",