Build failures on every push except pass on cache rebuild

This just started happening, but any commit that causes a rebuild results in a failure, but if I do “Clear cache and redeploy” it seems to resolve itself. Not sure how to diagnose what’s getting cached and causing the build failures.

Does anyone have any ideas?

8:50:47 AM: Build ready to start
8:50:49 AM: build-image version: 9cade8af58c2cf3a17a1e9433d2e979149488837
8:50:49 AM: build-image tag: v3.3.5
8:50:49 AM: buildbot version: 2fd8f04962d5dbc77b79b9c2f5ab7a077e87376b
8:50:50 AM: Fetching cached dependencies
8:50:50 AM: Starting to download cache of 221.2MB
8:50:51 AM: Finished downloading cache in 1.380728471s
8:50:51 AM: Starting to extract cache
8:51:00 AM: Finished extracting cache in 9.009649674s
8:51:00 AM: Finished fetching cache in 10.50248378s
8:51:00 AM: Starting to prepare the repo for build
8:51:01 AM: Preparing Git Reference pull/37/head
8:51:02 AM: Found Netlify configuration file netlify.toml in site root
8:51:02 AM: Found Netlify configuration file(s). Overriding site configuration
8:51:02 AM: Starting build script
8:51:02 AM: Installing dependencies
8:51:03 AM: Started restoring cached node version
8:51:06 AM: Finished restoring cached node version
8:51:07 AM: v10.19.0 is already installed.
8:51:08 AM: Now using node v10.19.0 (npm v6.13.4)
8:51:08 AM: Attempting ruby version 2.6.2, read from environment
8:51:10 AM: Using ruby version 2.6.2
8:51:10 AM: Using PHP version 5.6
8:51:10 AM: Started restoring cached node modules
8:51:10 AM: Finished restoring cached node modules
8:51:10 AM: Started restoring cached yarn cache
8:51:10 AM: Finished restoring cached yarn cache
8:51:11 AM: Installing NPM modules using Yarn version 1.17.0
8:51:12 AM: yarn install v1.17.0
8:51:12 AM: [1/4] Resolving packages...
8:51:13 AM: [2/4] Fetching packages...
8:51:43 AM: info fsevents@2.1.2: The platform "linux" is incompatible with this module.
8:51:43 AM: info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
8:51:43 AM: info fsevents@1.2.9: The platform "linux" is incompatible with this module.
8:51:43 AM: info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
8:51:43 AM: [3/4] Linking dependencies...
8:51:43 AM: warning " > react-redux@7.1.3" has unmet peer dependency "redux@^2.0.0 || ^3.0.0 || ^4.0.0-0".
8:51:43 AM: warning "react-scripts > eslint-config-react-app@5.2.0" has incorrect peer dependency "eslint-plugin-flowtype@3.x".
8:51:43 AM: warning "@bahmutov/add-typescript-to-cypress > @cypress/webpack-preprocessor@4.1.0" has unmet peer dependency "webpack@^4.18.1".
8:52:06 AM: [4/4] Building fresh packages...
8:52:09 AM: Done in 56.95s.
8:52:09 AM: NPM modules installed using Yarn
8:52:09 AM: Started restoring cached go cache
8:52:09 AM: Finished restoring cached go cache
8:52:09 AM: unset GOOS;
8:52:09 AM: unset GOARCH;
8:52:09 AM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
8:52:09 AM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
8:52:09 AM: go version >&2;
8:52:09 AM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
8:52:09 AM: go version go1.12 linux/amd64
8:52:09 AM: Installing missing commands
8:52:09 AM: Verify run directory
8:52:09 AM: Executing user command: yarn build
8:52:09 AM: yarn run v1.17.0
8:52:09 AM: $ NODE_ENV=production npm run css:build && react-scripts build
8:52:10 AM: npm
8:52:10 AM: WARN
8:52:10 AM:  lifecycle The node binary used for scripts is /tmp/yarn--1581349929791-0.5119074241825483/node but npm is using /opt/buildhome/.nvm/versions/node/v10.19.0/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
8:52:10 AM: > sm-endeavour@1.0.0 css:build /opt/build/repo
8:52:10 AM: > postcss .tailwind/tailwind.src.css -o src/tailwind/tailwind.css
8:52:19 AM: Creating an optimized production build...
8:53:00 AM: Failed to compile.
8:53:00 AM: ./src/common/forms/FormikInputErrors.tsx 1:320
8:53:00 AM: Module parse failed: Unexpected token (1:320)
8:53:00 AM: File was processed with these loaders:
8:53:00 AM:  * ./node_modules/babel-loader/lib/index.js
8:53:00 AM:  * ./node_modules/eslint-loader/dist/cjs.js
8:53:00 AM: You may need an additional loader to handle the result of these loaders.
8:53:00 AM: > import{ErrorMessage}from'formik';import React from'react';import InputFeedback from'./InputFeedback';var FormikInputError=function FormikInputError(_ref){var name=_ref.name,id=_ref.id;return React.createElement(ErrorMessage,{name:name,render:function render(errorMessage){return React.createElement(InputFeedback,{id:id??"".concat(name,"Error")},errorMessage);}});};export default FormikInputError;
8:53:00 AM: error Command failed with exit code 1.
8:53:00 AM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
8:53:00 AM: Skipping functions preparation step: no functions directory set
8:53:00 AM: Caching artifacts
8:53:00 AM: Started saving node modules
8:53:00 AM: Finished saving node modules
8:53:00 AM: Started saving yarn cache
8:53:00 AM: Finished saving yarn cache
8:53:00 AM: Started saving pip cache
8:53:00 AM: Finished saving pip cache
8:53:00 AM: Started saving emacs cask dependencies
8:53:00 AM: Finished saving emacs cask dependencies
8:53:00 AM: Started saving maven dependencies
8:53:00 AM: Finished saving maven dependencies
8:53:00 AM: Started saving boot dependencies
8:53:00 AM: failed during stage 'building site': Build script returned non-zero exit code: 1
8:53:00 AM: Finished saving boot dependencies
8:53:00 AM: Started saving go dependencies
8:53:00 AM: Finished saving go dependencies
8:53:00 AM: Error running command: Build script returned non-zero exit code: 1
8:53:00 AM: Failing build: Failed to build site
8:53:01 AM: Finished processing build request in 2m11.49126753s

Hi there, this is undeniably the problem:

8:53:00 AM: You may need an additional loader to handle the result of these loaders.
8:53:00 AM: > import{ErrorMessage}from'formik';import React from'react';import InputFeedback from'./InputFeedback';var FormikInputError=function FormikInputError(_ref){var name=_ref.name,id=_ref.id;return React.createElement(ErrorMessage,{name:name,render:function render(errorMessage){return React.createElement(InputFeedback,{id:id??"".concat(name,"Error")},errorMessage);}});};export default FormikInputError;
8:53:00 AM: error Command failed with exit code 1.

is this helpful at all?

Hey Perry,

I did investigate that but didn’t notice anything out of the ordinary with that code.
I’m using create-react-app and locally in dev and if I run a build it builds without issue and cannot seem to re-create that error locally.

if the error doesn’t happen locally, I am going to bet that it is a case sensitivity issue of some kind.

More information:

Will you check and see if you are dealing with something similar?

I ended up fixing this on my end. Just posting a solution in case it might happen to someone else.

I ended up deleting node_modules and the yarn.lock to perform a fresh yarn install. After running that I started receiving weird issues in Jest about esModuleInterop. I then cleared my jest cache using yarn test --clearCache and re-ran the tests. After performing that my tests passed. I pushed the changes to my branch and netlify no longer complained about the loader.

Seems like my yarn.lock got messed up and rebuilding it seemed to fix it.

Thanks for everyone that looked at this.

thanks for sharing your process around fixing this - that may well help other people for sure.