fix: add husky install fallback - #591
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: dd4ab94 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Collaborator
Priyanshubhartistm
marked this pull request as draft
April 30, 2026 15:48
Priyanshubhartistmforce-pushed
the
fix/husky-not-found
branch
from
April 30, 2026 17:27
97bc1bf to
66534a0ComparePriyanshubhartistm
marked this pull request as ready for review
April 30, 2026 17:31
cameri
reviewed
Apr 30, 2026
Uh oh!
There was an error while loading. Please reload this page.
cameri
reviewed
Apr 30, 2026
Uh oh!
There was an error while loading. Please reload this page.
Priyanshubhartistmforce-pushed
the
fix/husky-not-found
branch
2 times, most recently
from
May 1, 2026 08:28
29f9847 to
044327bComparePriyanshubhartistm
marked this pull request as draft
May 1, 2026 09:07
Priyanshubhartistmforce-pushed
the
fix/husky-not-found
branch
3 times, most recently
from
May 1, 2026 19:12
84b02e9 to
6bd9239CompareReplace the inline 'husky install || exit 0' prepare script with a dedicated .husky/install.mjs that skips installation cleanly in production, CI, Docker, and HUSKY=0 environments. Closescameri#328
Priyanshubhartistmforce-pushed
the
fix/husky-not-found
branch
from
May 1, 2026 19:35
6bd9239 to
dd4ab94ComparePriyanshubhartistm
marked this pull request as ready for review
May 1, 2026 19:39
CollaboratorAuthor
@cameri The PR is up for review. Please take a look when you are free. |
cameri
approved these changes
May 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
I fixed the Husky install path that was causing sh: husky: not found.
The old prepare script ran husky install exit 0. That avoided failing the install, but it still printed the shell
error first when Husky was not installed.
I moved that logic into .husky/install.mjs so Husky is skipped cleanly in production, CI, HUSKY=0, and installs where
the Husky package is not available.
I also updated the Dockerfiles so .husky/install.mjs is copied before npm install runs.
Related Issue
Fixes#328
Motivation and Context
Husky is only needed for local git hooks. It should not make production, CI, or Docker installs look broken when dev
dependencies are missing.
This keeps local hook setup working, but avoids the noisy sh: husky: not found message in environments where Husky
should be skipped.
How Has This Been Tested?
I verified the script syntax:
node --check .husky/install.mjs
I verified the skip paths:
NODE_ENV=production npm run prepare --silent
CI=true npm run prepare --silent
HUSKY=0 npm run prepare --silent
npm_config_omit=dev npm run prepare --silent
All commands completed successfully without printing the Husky error.
I also checked the old behavior still reproduces the original issue:
sh -c 'husky install exit 0'
It prints:
sh: 1: husky: not found
Screenshots (if appropriate):
Types of changes
Checklist: