'husky install' fails on a Serverless deploy because there is no .git folder
See original GitHub issueI am still facing issue #851 when deploying a Serverless app.
The content of the Serverless folder after running npm install
is only:
drwxr-xr-x 5 carlos staff 160 Jan 9 14:43 .
drwxr-xr-x 3 carlos staff 96 Jan 9 14:43 ..
drwxr-xr-x 164 carlos staff 5248 Jan 9 14:43 node_modules
-rw-r--r-- 1 carlos staff 1869687 Jan 9 14:43 package-lock.json
-rw-r--r-- 1 carlos staff 4480 Jan 9 14:43 package.json
Since it’s a deploy, but not a CI environment, I couldn’t find anything useful on husky docs to sort this out.

Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:6 (2 by maintainers)
Top Results From Across the Web
How to fix error 'not found husky-run' when committing new ...
I checked the package.json and it has husky as a dependency, and I can see the pre-commit hook configuration for Husky in the...
Read more >serverless | Yarn - Package Manager
Serverless Framework - Build web, mobile and IoT applications with serverless architectures using AWS Lambda, Azure Functions, Google CloudFunctions & more.
Read more >Learn How to Setup Git Hooks in GitKraken Client
Users can define a custom path for git hooks by going to Preferences Git Hooks. Browse to the location or enter the path...
Read more >hint: if you don't want pnpm to fail on peer dependency issues, add ...
Peer dependencies are resolved from dependencies installed higher in the dependency graph, since they share the same version as their .
Read more >Frictionless Serverless Development: Part 1 — Setting Up ...
Frictionless Serverless Development: Part 1 — Setting Up Your Environment (husky, lint-staged, eslint, prettier, commitlint). Binary globe with police ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Although I see and agree, I think the package could find a way to identify if the package installation is happening in an environment without git, and not throw an error.
@JanFellner I’d recommend using
prepare
instead ofpostinstall
.prepare
will only run in “development”, whereaspostinstall
will always run (even when the package is installed innode_modules
).