Gatsby Build Error "TypeError: Unexpected response from worker: undefined"

Hello,

I’m trying to get a site deployed and just catching up on the new build/deploy settings but they are not making sense. I have tried several different attempts and I am running out of minutes on my current plan. I changed the build setting in the backend of Netlify as seen in the screen-shot. Do I need to change anything in my package.json as well? Would love some help please, thank you in advance!

Here is what my settings are currently:

and here is a log out put from my most recent build attempt:

1:40:38 AM: Build ready to start
1:40:40 AM: build-image version: 3031d4c9e432fd7016f6279fc9ad706f9205d845
1:40:40 AM: build-image tag: v3.3.17
1:40:40 AM: buildbot version: da42b14a989873e00cc6f36bc354c01953474181
1:40:40 AM: Fetching cached dependencies
1:40:40 AM: Starting to download cache of 398.6MB
1:40:48 AM: Finished downloading cache in 8.027859004s
1:40:48 AM: Starting to extract cache
1:41:03 AM: Finished extracting cache in 15.035834055s
1:41:03 AM: Finished fetching cache in 23.147318365s
1:41:03 AM: Starting to prepare the repo for build
1:41:04 AM: Preparing Git Reference refs/heads/master
1:41:05 AM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'public' versus 'public/' in the Netlify UI
1:41:05 AM: Starting build script
1:41:06 AM: Installing dependencies
1:41:06 AM: Python version set to 2.7
1:41:06 AM: Started restoring cached node version
1:41:12 AM: Finished restoring cached node version
1:41:13 AM: v10.21.0 is already installed.
1:41:14 AM: Now using node v10.21.0 (npm v6.14.4)
1:41:14 AM: Started restoring cached build plugins
1:41:14 AM: Finished restoring cached build plugins
1:41:14 AM: Attempting ruby version 2.6.2, read from environment
1:41:15 AM: Using ruby version 2.6.2
1:41:15 AM: Using PHP version 5.6
1:41:16 AM: 5.2 is already installed.
1:41:16 AM: Using Swift version 5.2
1:41:16 AM: Started restoring cached node modules
1:41:16 AM: Finished restoring cached node modules
1:41:16 AM: Started restoring cached yarn cache
1:41:16 AM: Finished restoring cached yarn cache
1:41:16 AM: Installing NPM modules using Yarn version 1.13.0
1:41:17 AM: yarn install v1.13.0
1:41:17 AM: warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
1:41:17 AM: [1/4] Resolving packages...
1:41:18 AM: warning gatsby > babel-plugin-add-module-exports > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
1:41:18 AM: warning gatsby > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
1:41:18 AM: warning gatsby > gatsby-cli > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
1:41:18 AM: warning gatsby > webpack-dev-server > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
1:41:20 AM: warning gatsby > webpack > watchpack > watchpack-chokidar2 > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
1:41:25 AM: warning babel-cli > chokidar@1.7.0: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
1:41:25 AM: warning babel-cli > chokidar > fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
1:41:25 AM: warning jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
1:41:25 AM: warning jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > left-pad@1.3.0: use String.prototype.padStart()
1:41:26 AM: warning jest-dom@3.5.0: 🚨 jest-dom has moved to @testing-library/jest-dom. Please uninstall jest-dom and install @testing-library/jest-dom instead, or use an older version of jest-dom. Learn more about this change here: https://github.com/testing-library/dom-testing-library/issues/260 Thanks! :)
1:41:26 AM: warning react-testing-library@7.0.1: 🚨  react-testing-library has moved to @testing-library/react. Please uninstall react-testing-library and install @testing-library/react instead, or use an older version of react-testing-library. Learn more about this change here: https://github.com/testing-library/dom-testing-library/issues/260 Thanks! :)
1:41:26 AM: warning react-testing-library > dom-testing-library@4.1.1: 🚨  dom-testing-library has moved to @testing-library/dom. Please uninstall dom-testing-library and install @testing-library/dom instead, or use an older version of dom-testing-library. Learn more about this change here: https://github.com/testing-library/dom-testing-library/issues/260 Thanks! :)
1:41:27 AM: warning tslint-react@4.2.0: TSLint has been deprecated in favor of ESLint. Please see https://github.com/palantir/tslint-react/issues/210 for more information.
1:41:27 AM: [2/4] Fetching packages...
1:41:57 AM: info fsevents@1.2.9: The platform "linux" is incompatible with this module.
1:41:57 AM: info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
1:41:57 AM: info fsevents@2.1.3: The platform "linux" is incompatible with this module.
1:41:57 AM: info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
1:41:57 AM: info fsevents@1.2.13: The platform "linux" is incompatible with this module.
1:41:57 AM: info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
1:41:57 AM: [3/4] Linking dependencies...
1:41:57 AM: warning "gatsby > @pmmmwh/react-refresh-webpack-plugin@0.3.3" has incorrect peer dependency "react-refresh@^0.8.2".
1:41:57 AM: warning " > babel-loader@8.1.0" has unmet peer dependency "webpack@>=2".
1:41:57 AM: warning "gatsby-plugin-netlify > webpack-assets-manifest@3.1.1" has unmet peer dependency "webpack@>=4.4.0".
1:41:57 AM: warning "react-pose > popmotion-pose > pose-core > rollup-plugin-typescript2@0.25.3" has unmet peer dependency "rollup@>=1.26.3".
1:41:57 AM: warning " > react-test-renderer@16.13.1" has incorrect peer dependency "react@^16.13.1".
1:42:38 AM: [4/4] Building fresh packages...
1:42:45 AM: success Saved lockfile.
1:42:45 AM: Done in 88.39s.
1:42:45 AM: NPM modules installed using Yarn
1:42:45 AM: Started restoring cached go cache
1:42:45 AM: Finished restoring cached go cache
1:42:45 AM: Installing Go version 1.12
1:42:51 AM: unset GOOS;
1:42:51 AM: unset GOARCH;
1:42:51 AM: export GOROOT='/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64';
1:42:51 AM: export PATH="/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64/bin:${PATH}";
1:42:51 AM: go version >&2;
1:42:51 AM: export GIMME_ENV="/opt/buildhome/.gimme_cache/env/go1.12.linux.amd64.env"
1:42:51 AM: go version go1.12 linux/amd64
1:42:51 AM: Installing missing commands
1:42:51 AM: Verify run directory
1:42:52 AM: ​
1:42:52 AM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
1:42:52 AM: β”‚        Netlify Build        β”‚
1:42:52 AM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
1:42:52 AM: ​
1:42:52 AM: ❯ Version
1:42:52 AM:   @netlify/build 2.0.10
1:42:52 AM: ​
1:42:52 AM: ❯ Flags
1:42:52 AM:   deployId: 5eeda1568ae8d05545e3c05b
1:42:52 AM:   mode: buildbot
1:42:52 AM: ​
1:42:52 AM: ❯ Current directory
1:42:52 AM:   /opt/build/repo
1:42:52 AM: ​
1:42:52 AM: ❯ Config file
1:42:52 AM:   No config file was defined: using default values.
1:42:52 AM: ​
1:42:52 AM: ❯ Context
1:42:52 AM:   production
1:42:52 AM: ​
1:42:52 AM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
1:42:52 AM: β”‚ 1. Build command from settings β”‚
1:42:52 AM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
1:42:52 AM: ​
1:42:52 AM: $ CI= npm run build
1:42:52 AM: > gatsby-starter-default@0.1.0 build /opt/build/repo
1:42:52 AM: > gatsby build
1:42:56 AM: success open and validate gatsby-configs - 0.062s
1:42:57 AM: success load plugins - 1.128s
1:42:57 AM: success onPreInit - 0.010s
1:42:57 AM: success delete html and css files from previous builds - 0.012s
1:42:57 AM: success initialize cache - 0.006s
1:42:57 AM: success copy gatsby files - 0.031s
1:42:57 AM: success onPreBootstrap - 0.007s
1:42:57 AM: success createSchemaCustomization - 0.009s
1:42:58 AM: success source and transform nodes - 0.849s
1:42:58 AM: success building schema - 0.319s
1:42:58 AM: success createPages - 0.015s
1:42:58 AM: success createPagesStatefully - 0.090s
1:42:58 AM: success updating schema - 0.018s
1:42:58 AM: success onPreExtractQueries - 0.000s
1:42:59 AM: success extract queries from components - 0.572s
1:42:59 AM: success write out requires - 0.004s
1:42:59 AM: success write out redirect data - 0.001s
1:42:59 AM: success Build manifest and related icons - 0.118s
1:42:59 AM: success onPostBootstrap - 0.119s
1:42:59 AM: info bootstrap finished - 6.724s
1:43:14 AM: warning Query takes too long:
1:43:14 AM: File path: /opt/build/repo/src/components/image.tsx
1:43:14 AM: warning Query takes too long:
1:43:14 AM: File path: /opt/build/repo/src/components/imageModules/backgroundDividerImg.tsx
1:43:14 AM: warning Query takes too long:
1:43:14 AM: File path: /opt/build/repo/src/components/imageModules/backgroundTileImg.tsx
1:43:14 AM: warning Query takes too long:
1:43:14 AM: File path: /opt/build/repo/src/components/imageModules/classHeroImg.tsx
1:43:17 AM: success run static queries - 18.093s - 16/16 0.88/s
1:43:53 AM: success Building production JavaScript and CSS bundles - 35.948s
1:43:53 AM: success Rewriting compilation hashes - 0.117s
1:43:53 AM: success run page queries - 0.010s - 8/8 786.44/s
1:49:35 AM: onSale false
1:49:35 AM: /opt/build/repo/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
1:49:35 AM:         throw ex;
1:49:35 AM:         ^
1:49:35 AM: TypeError: Unexpected response from worker: undefined
1:49:35 AM:     at ChildProcessWorker.onMessage (/opt/build/repo/node_modules/jest-worker/build/workers/ChildProcessWorker.js:257:15)
1:49:35 AM:     at ChildProcess.emit (events.js:198:13)
1:49:35 AM:     at emit (internal/child_process.js:832:12)
1:49:35 AM:     at process._tickCallback (internal/process/next_tick.js:63:19)
1:49:36 AM: npm ERR! code ELIFECYCLE
1:49:36 AM: npm ERR! errno 7
1:49:36 AM: npm ERR! gatsby-starter-default@0.1.0 build: `gatsby build`
1:49:36 AM: npm ERR! Exit status 7
1:49:36 AM: npm ERR!
1:49:36 AM: npm ERR! Failed at the gatsby-starter-default@0.1.0 build script.
1:49:36 AM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
1:49:36 AM: npm ERR! A complete log of this run can be found in:
1:49:36 AM: npm ERR!     /opt/buildhome/.npm/_logs/2020-06-20T05_49_36_020Z-debug.log
1:49:36 AM: ​
1:49:36 AM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
1:49:36 AM: β”‚   "build.command" failed    β”‚
1:49:36 AM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
1:49:36 AM: ​
1:49:36 AM:   Error message
1:49:36 AM:   Command failed with exit code 7: CI= npm run build
1:49:36 AM: ​
1:49:36 AM:   Error location
1:49:36 AM:   In Build command from settings:
1:49:36 AM:   CI= npm run build
1:49:36 AM: ​
1:49:36 AM:   Resolved config
1:49:36 AM:   build:
1:49:36 AM:     command: CI= npm run build
1:49:36 AM:     publish: /opt/build/repo/public
1:49:36 AM: Caching artifacts
1:49:36 AM: Started saving node modules
1:49:36 AM: Finished saving node modules
1:49:36 AM: Started saving build plugins
1:49:36 AM: Finished saving build plugins
1:49:36 AM: Started saving yarn cache
1:49:36 AM: Finished saving yarn cache
1:49:36 AM: Started saving pip cache
1:49:36 AM: Finished saving pip cache
1:49:36 AM: Started saving emacs cask dependencies
1:49:36 AM: Finished saving emacs cask dependencies
1:49:36 AM: Started saving maven dependencies
1:49:36 AM: Finished saving maven dependencies
1:49:36 AM: Started saving boot dependencies
1:49:36 AM: Finished saving boot dependencies
1:49:36 AM: Started saving go dependencies
1:49:38 AM: Finished saving go dependencies
1:49:38 AM: Error running command: Build script returned non-zero exit code: 1
1:49:38 AM: Failing build: Failed to build site
1:49:38 AM: Failed during stage 'building site': Build script returned non-zero exit code: 1
1:49:38 AM: Finished processing build request in 8m57.901432244s

Hmmm, it looks like everything up to npm run build goes just fine. Does your build run locally? If it doesn’t, then there’s no way the Netlify build environment will be able to get through the build either.

I’m looking through your logs and things seem to go south around here:

In particular I’d say this is what you’ll need to debug:

I’d go back and verify that there isn’t anything blocking the build from running successfully, as it appears this is an issue with Gatsby and not your build settings. The build command may have something to do with it but judging by the warnings you’re getting and then finally a thrown TypeError which forces the build to stop.

Best of luck fixing!

Thanks for taking a look @noelforte.

Yes it builds locally just fine. I guess I’m not sure what to do if its an internal error with Gatsby :frowning:

Cheers,
S

Hey @biggs,
I’m taking a look and it seems you got a build working? If so, I’d love to hear how you fixed (my guess is package versions?), and if not, let me know so I or one of my colleagues can dig in further.

I’ve also updated the title and tags of this post to make it more discoverable.

@jen - Thank you so much for looking at this! I saw that in the logs there was an error with a β€œWorker” and I thought maybe I should update gatsby-plugin-netlify and gatsby-plugin-offline. So I did then committed changes to GIT and boom! It worked :slight_smile:

But yes, odd I was able to build locally but not in production.

1 Like