Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production pipeline with omit-dev failed due to postinstall "husky install" #30

Open
petross3530mx opened this issue Mar 28, 2024 · 8 comments
Labels
issue: bug Issue reporting a bug status: pending reproduction Waiting for free time to reproduce the issue, or more information

Comments

@petross3530mx
Copy link

Hi dear contributors!

I have some problems with this line of code.

"postinstall": "husky install",

The main problem happened when running typical build command ( for example in nextjs, for example in docker, some pipelines ) , for which dependencies under "dependencies" block typically is required, but devDependencies should be is not required (omit=dev)
So husky is not installed for omit=dev, but docker tried to run postinstall command and pipeline failing

image

So there are a some possible solutions:

  1. Add condition to postinstall script to run husky only if it installed
    "scripts": {
    "postinstall": "if [ -d node_modules/husky ]; then husky install; fi"
    }

  2. Using prepare script for husky, which will be automatically called before npm publish
    "scripts": {
    "prepare": "husky install"
    }

  3. Install all the dependencies using npm install (without omit dev).
    Is not the best practice as devDependencies will be installed for builld

  4. Add husky to dependencies package json section which can be ok only as fast temporary fix

@EvgeniyShigartsov

This comment was marked as spam.

@joshuaellis joshuaellis added issue: bug Issue reporting a bug status: pending reproduction Waiting for free time to reproduce the issue, or more information labels Mar 28, 2024
@dpaul20

This comment was marked as spam.

@StructuralRealist
Copy link

I have this problem when simply installing the package (not in a pipeline or during a build command). See #34 for steps to reproduce.

@salimdellali

This comment has been minimized.

@anubahv-emt
Copy link

how to resolve this ? I am stuck on this tried adding husky under dependencies

@Abuddabi
Copy link

Abuddabi commented Jun 1, 2024

have the same issue in developing mode

@monyiliev
Copy link

Same issue while installing the package. Thanks.

@anubahv-emt
Copy link

using pnpm for now instead of npm, seems to be working fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug Issue reporting a bug status: pending reproduction Waiting for free time to reproduce the issue, or more information
Projects
None yet
Development

No branches or pull requests

9 participants