fix: add husky install fallback#591
Open
Priyanshubhartistm wants to merge 1 commit intocameri:mainfrom
Open
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
97bc1bf to
66534a0
Compare
cameri
reviewed
Apr 30, 2026
cameri
reviewed
Apr 30, 2026
29f9847 to
044327b
Compare
84b02e9 to
6bd9239
Compare
Replace 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. Closes cameri#328
6bd9239 to
dd4ab94
Compare
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 free
to 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: