Skip to content

fix: add husky install fallback#591

Open
Priyanshubhartistm wants to merge 1 commit intocameri:mainfrom
Priyanshubhartistm:fix/husky-not-found
Open

fix: add husky install fallback#591
Priyanshubhartistm wants to merge 1 commit intocameri:mainfrom
Priyanshubhartistm:fix/husky-not-found

Conversation

@Priyanshubhartistm
Copy link
Copy Markdown
Collaborator

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):

image

Types of changes

  • Non-functional change (docs, style, minor refactor)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my code changes.
  • I added a changeset, or this is docs-only and I added an empty changeset.
  • All new and existing tests passed.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 30, 2026

🦋 Changeset detected

Latest commit: dd4ab94

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
nostream Patch

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

@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented Apr 30, 2026

Coverage Status

coverage: 64.58%. remained the same — Priyanshubhartistm:fix/husky-not-found into cameri:main

@Priyanshubhartistm Priyanshubhartistm marked this pull request as draft April 30, 2026 15:48
@Priyanshubhartistm Priyanshubhartistm marked this pull request as ready for review April 30, 2026 17:31
Comment thread Dockerfile.railwayapp Outdated
Comment thread Dockerfile Outdated
@Priyanshubhartistm Priyanshubhartistm force-pushed the fix/husky-not-found branch 2 times, most recently from 29f9847 to 044327b Compare May 1, 2026 08:28
@Priyanshubhartistm Priyanshubhartistm marked this pull request as draft May 1, 2026 09:07
@Priyanshubhartistm Priyanshubhartistm force-pushed the fix/husky-not-found branch 3 times, most recently from 84b02e9 to 6bd9239 Compare May 1, 2026 19:12
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
@Priyanshubhartistm Priyanshubhartistm marked this pull request as ready for review May 1, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] sh: husky: not found

3 participants