Production pipeline with omit-dev failed due to postinstall "husky install" #30
Labels
issue: bug
Issue reporting a bug
status: pending reproduction
Waiting for free time to reproduce the issue, or more information
Hi dear contributors!
I have some problems with this line of code.
blocks-react-renderer/package.json
Line 47 in 4c6faf1
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
So there are a some possible solutions:
Add condition to postinstall script to run husky only if it installed
"scripts": {
"postinstall": "if [ -d node_modules/husky ]; then husky install; fi"
}
Using prepare script for husky, which will be automatically called before npm publish
"scripts": {
"prepare": "husky install"
}
Install all the dependencies using npm install (without omit dev).
Is not the best practice as devDependencies will be installed for builld
Add husky to dependencies package json section which can be ok only as fast temporary fix
The text was updated successfully, but these errors were encountered: