The build works if I run it after clearing the cache, but not normally. Any commit I push will trigger a build and deploy that always fails. Here’s the build log.
7:08:38 PM: Build ready to start
7:08:40 PM: build-image version: ac716c5be7f79fe384a0f3759e8ef612cb821a37 (xenial)
7:08:40 PM: build-image tag: v3.13.0
7:08:40 PM: buildbot version: 0475eccc4c4863180929fe6d58b546f8277ad384
7:08:40 PM: Fetching cached dependencies
7:08:41 PM: Starting to download cache of 308.3MB
7:08:45 PM: Finished downloading cache in 4.658475551s
7:08:45 PM: Starting to extract cache
7:08:59 PM: Finished extracting cache in 14.325588153s
7:08:59 PM: Finished fetching cache in 19.01869053s
7:08:59 PM: Starting to prepare the repo for build
7:09:00 PM: Preparing Git Reference refs/heads/develop
7:09:00 PM: Error checking out branch: HEAD is now at ef4cd31 Added .node-version
.husky/post-checkout: 2: .: Can't open .husky/_/husky.sh
7:09:00 PM: Creating deploy upload records
7:09:00 PM: Failing build: Failed to prepare repo
7:09:00 PM: Failed during stage 'preparing repo': exit status 1
7:09:01 PM: Finished processing build request in 20.70813322s
Thanks for providing those links! We’ve taken a look at your build logs and it looks like the cache we’re storing of your git repo is not working. These are the commands that our build environment runs to prepare your repo for a new build:
These commands lead to the error you’re seeing in the build logs here. The output is a bit confusing; it might be about a post-commit hook, so can you try removing any post-commit hooks and let us know if that changes the behavior?
I’m glad you got things working, and while we’re not too familiar with Husky and how it works, it’s likely that something about that hook in particular interfered with Husky.
For anyone else that arrives here from the Googles, the problem is that Husky recommends you setup a prepare: husky install script to ensure your git hooks are always installed when ever someone sets up your repo. This means that Netlify’s cached build will have your git hooks setup. Husky has various options in their documentation for disabling it in CI.
The easiest I’ve found is using the is-ci version.