Site works using gatsby develop. Error occurs during build on local machine, and on netlify. Log output below.
Source: https://github.com/iammatthias/.com/tree/staging
Any help would be appreciated!
Log on Netlify: https://app.netlify.com/sites/iamnet/deploys/5c53dd88b966330008c70bb2
9:13:17 PM: Build ready to start
9:13:20 PM: build-image version: 84aca9ba39e0ee86ba194760fbfc51a808f62543
9:13:20 PM: buildbot version: 57d44fd1631cc3fff8b38fbaf88d3d04f946418a
9:13:20 PM: Fetching cached dependencies
9:13:20 PM: Starting to download cache of 254.7KB
9:13:20 PM: Finished downloading cache in 90.065157ms
9:13:20 PM: Starting to extract cache
9:13:20 PM: Failed to fetch cache, continuing with build
9:13:20 PM: Starting to prepare the repo for build
9:13:20 PM: No cached dependencies found. Cloning fresh repo
9:13:20 PM: git clone https://github.com/iammatthias/net
9:13:22 PM: Preparing Git Reference pull/22/head
9:13:23 PM: Starting build script
9:13:23 PM: Installing dependencies
9:13:23 PM: Attempting node version 'v10.13.0' from .nvmrc
9:13:24 PM: Downloading and installing node v10.13.0...
9:13:24 PM: Downloading https://nodejs.org/dist/v10.13.0/node-v10.13.0-linux-x64.tar.xz...
9:13:24 PM: 1.1%
9:13:24 PM:
#####################
9:13:24 PM: 30.2%
9:13:24 PM:
#################################################
9:13:24 PM: ############# 86.2%
9:13:24 PM:
######################################################################## 100.0%
9:13:24 PM: Computing checksum with sha256sum
9:13:25 PM: Checksums matched!
9:13:27 PM: Now using node v10.13.0 (npm v6.4.1)
9:13:27 PM: Attempting ruby version 2.3.6, read from environment
9:13:29 PM: Using ruby version 2.3.6
9:13:29 PM: Using PHP version 5.6
9:13:29 PM: Started restoring cached node modules
9:13:29 PM: Finished restoring cached node modules
9:13:29 PM: Started restoring cached yarn cache
9:13:29 PM: Finished restoring cached yarn cache
9:13:29 PM: Installing yarn at version 1.3.2
9:13:29 PM: Installing Yarn!
9:13:29 PM: > Downloading tarball...
9:13:29 PM: [1/2]: https://yarnpkg.com/downloads/1.3.2/yarn-v1.3.2.tar.gz --> /tmp/yarn.tar.gz.FpXYkGVO3U
9:13:29 PM: % Total % Received % Xferd Average Speed Time Time Time Current
9:13:29 PM: Dload Upload Total Spent Left Speed
9:13:29 PM:
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
9:13:29 PM:
100 91 100 91 0 0 632 0 --:--:-- --:--:-- --:--:-- 636
9:13:29 PM:
0 0 0 608 0 0 1709 0 --:--:-- --:--:-- --:--:--
9:13:29 PM: 1709
9:13:30 PM:
2 865k 2 24924 0 0 41974 0 0:00:21 -
9:13:30 PM: -:--:-- 0:00:21 41974
9:13:30 PM:
100 865k 100 865k 0 0 1192k 0 --:--:-- --:--:-
9:13:30 PM: - --:--:-- 6422k
9:13:30 PM: [2/2]: https://yarnpkg.com/downloads/1.3.2/yarn-v1.3.2.tar.gz.asc --> /tmp/yarn.tar.gz.FpXYkGVO3U.asc
9:13:30 PM:
100 95 100 95 0 0 1919 0 --:--:-- --:--:--
9:13:30 PM: --:--:-- 1919
9:13:30 PM:
0 0 0 612 0 0 3935 0 --:--:-- --:--:-- --:--:-- 3935
9:13:30 PM:
100 1027 100 1027 0 0 5149 0 --:--:-- --:--:-- --:--:-- 5149
9:13:30 PM: > Verifying integrity...
9:13:30 PM: gpg: Signature made Thu 02 Nov 2017 04:44:10 PM UTC using RSA key ID FD2497F5
9:13:30 PM: gpg: Good signature from "Yarn Packaging <[email protected]>"
9:13:30 PM: gpg: Note: This key has expired!
9:13:30 PM: Primary key fingerprint: 72EC F46A 56B4 AD39 C907 BBB7 1646 B01B 86E5 0310
9:13:30 PM: Subkey fingerprint: 6A01 0C51 6600 6599 AA17 F081 46C2 130D FD24 97F5
9:13:30 PM: > GPG signature looks good
9:13:30 PM: > Extracting to ~/.yarn...
9:13:30 PM: > Adding to $PATH...
9:13:30 PM: > We've added the following to your /opt/buildhome/.profile
9:13:30 PM: > If this isn't the profile of your current shell then please add the following to your correct profile:
9:13:30 PM: export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
9:13:30 PM:
9:13:31 PM: > Successfully installed Yarn 1.3.2! Please open another terminal where the `yarn` command will now be available.
9:13:31 PM: Installing NPM modules using Yarn version 1.3.2
9:13:32 PM: yarn install v1.3.2
9:13:32 PM: (node:1332) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
9:13:32 PM: [1/4] Resolving packages...
9:13:33 PM: [2/4] Fetching packages...
9:13:55 PM: info [email protected]: The platform "linux" is incompatible with this module.
9:13:55 PM: info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
9:13:55 PM: [3/4] Linking dependencies...
9:13:55 PM: warning "gatsby > mini-css-extract-plugin > schema-utils > [email protected]" has unmet peer dependency "ajv@>=5.0.0".
9:13:55 PM: warning "gatsby-plugin-flow > @babel/[email protected]" has unmet peer dependency "@babel/core@^7.0.0-0".
9:13:56 PM: warning "gatsby-plugin-flow > @babel/preset-flow > @babel/[email protected]" has unmet peer dependency "@babel/core@^7.0.0-0".
9:13:56 PM: warning "gatsby-plugin-flow > @babel/preset-flow > @babel/plugin-transform-flow-strip-types > @babel/[email protected]" has unmet peer dependency "@babel/core@^7.0.0-0".
9:13:56 PM: warning "gatsby-plugin-netlify > [email protected]" has unmet peer dependency "webpack@>=4.4.0".
9:13:56 PM: warning "react-images > [email protected]" has incorrect peer dependency "react@^0.14 || ^15.0".
9:13:56 PM: warning "react-images > [email protected]" has unmet peer dependency "prop-types@^15.5.8".
9:13:56 PM: warning " > [email protected]" has unmet peer dependency "[email protected]".
9:13:56 PM: warning "stylelint > [email protected]" has unmet peer dependency "postcss@>=5.0.0".
9:13:56 PM: warning "stylelint > [email protected]" has unmet peer dependency "postcss@>=5.0.0".
9:13:56 PM: warning "stylelint > [email protected]" has unmet peer dependency "postcss@>=5.0.0".
9:13:56 PM: warning "stylelint > [email protected]" has unmet peer dependency "postcss@>=5.0.0".
9:13:56 PM: warning "stylelint > [email protected]" has unmet peer dependency "postcss@>=5.0.0".
9:14:05 PM: [4/4] Building fresh packages...
9:14:09 PM: Done in 36.92s.
9:14:09 PM: NPM modules installed using Yarn
9:14:09 PM: (node:1445) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
9:14:09 PM: Started restoring cached go cache
9:14:09 PM: Finished restoring cached go cache
9:14:09 PM: unset GOOS;
9:14:09 PM: unset GOARCH;
9:14:09 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.10.linux.amd64';
9:14:09 PM: export PATH="/opt/buildhome/.gimme/versions/go1.10.linux.amd64/bin:${PATH}";
9:14:09 PM: go version >&2;
9:14:09 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.10.linux.amd64.env';
9:14:09 PM: go version go1.10 linux/amd64
9:14:09 PM: Installing missing commands
9:14:09 PM: Verify run directory
9:14:09 PM: Executing user command: yarn build
9:14:10 PM: yarn run v1.3.2
9:14:10 PM: (node:1498) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
9:14:10 PM: $ gatsby info && gatsby build
9:14:11 PM: System:
9:14:11 PM: OS: Linux 4.14 Ubuntu 14.04.5 LTS, Trusty Tahr
9:14:11 PM: CPU: (8) x64 Intel(R) Xeon(R) CPU @ 2.30GHz
9:14:11 PM: Shell: 4.3.11 - /bin/bash
9:14:11 PM: Binaries:
9:14:11 PM: Node: 10.13.0 - ~/.nvm/versions/node/v10.13.0/bin/node
9:14:11 PM: Yarn: 1.3.2 - /opt/build/cache/yarn/bin/yarn
9:14:11 PM: npm: 6.4.1 - ~/.nvm/versions/node/v10.13.0/bin/npm
9:14:11 PM: Languages:
9:14:11 PM: Python: 2.7.6 - /opt/buildhome/python2.7/bin/python
9:14:11 PM: npmPackages:
9:14:11 PM: gatsby: ^2.0.0-rc.13 => 2.0.106
9:14:11 PM: gatsby-image: ^2.0.0-rc.4 => 2.0.29
9:14:11 PM: gatsby-plugin-canonical-urls: ^2.0.0-rc.2 => 2.0.9
9:14:11 PM: gatsby-plugin-catch-links: ^2.0.2 => 2.0.9
9:14:11 PM: gatsby-plugin-feed: 2.0.9 => 2.0.9
9:14:11 PM: gatsby-plugin-flow: ^1.0.2 => 1.0.2
9:14:11 PM: gatsby-plugin-google-analytics: ^2.0.0-rc.2 => 2.0.12
9:14:11 PM: gatsby-plugin-manifest: 2.0.7 => 2.0.7
9:14:11 PM: gatsby-plugin-netlify: ^2.0.0-rc.2 => 2.0.7
9:14:11 PM: gatsby-plugin-nprogress: 2.0.6 => 2.0.6
9:14:11 PM: gatsby-plugin-offline: ^2.0.0-rc.4 => 2.0.22
9:14:11 PM: gatsby-plugin-react-helmet: 3.0.1 => 3.0.1
9:14:11 PM: gatsby-plugin-sitemap: ^2.0.0-rc.2 => 2.0.4
9:14:11 PM: gatsby-plugin-styled-components: ^3.0.4 => 3.0.4
9:14:11 PM: gatsby-plugin-typography: 2.2.1 => 2.2.1
9:14:11 PM: gatsby-remark-images-contentful: ^2.0.0-rc.6 => 2.0.6
9:14:11 PM: gatsby-remark-prismjs: 3.0.3 => 3.0.3
9:14:11 PM: gatsby-source-contentful: ^2.0.1-rc.4 => 2.0.28
9:14:12 PM: gatsby-source-filesystem: ^2.0.1-rc.2 => 2.0.18
9:14:12 PM: gatsby-transformer-remark: ^2.1.1-rc.5 => 2.2.2
9:14:13 PM: success open and validate gatsby-configs โ 0.013 s
9:14:14 PM: success load plugins โ 0.370 s
9:14:14 PM: success onPreInit โ 0.660 s
9:14:14 PM: success delete html and css files from previous builds โ 0.007 s
9:14:14 PM: success initialize cache โ 0.010 s
9:14:14 PM: success copy gatsby files โ 0.031 s
9:14:14 PM: success onPreBootstrap โ 0.019 s
9:14:15 PM: Starting to fetch data from Contentful
9:14:15 PM: Fetching default locale
9:14:15 PM: default locale is : en-US
9:14:15 PM: contentTypes fetched 7
9:14:15 PM: Updated entries 59
9:14:15 PM: Deleted entries 0
9:14:15 PM: Updated assets 604
9:14:15 PM: Deleted assets 0
9:14:15 PM: Fetch Contentful data: 724.317ms
9:14:16 PM: success source and transform nodes โ 1.285 s
9:14:16 PM: success building schema โ 0.590 s
9:14:16 PM: success createPages โ 0.095 s
9:14:17 PM: success createPagesStatefully โ 0.140 s
9:14:17 PM: success onPreExtractQueries โ 0.005 s
9:14:17 PM: success update schema โ 0.437 s
9:14:17 PM: success extract queries from components โ 0.210 s
9:14:19 PM: success run graphql queries โ 2.196 s โ 40/40 18.22 queries/second
9:14:19 PM: success write out page data โ 0.005 s
9:14:19 PM: success write out redirect data โ 0.001 s
9:14:20 PM: done generating icons for manifest
9:14:20 PM: success onPostBootstrap โ 0.305 s
9:14:20 PM: info bootstrap finished - 8.702 s
9:14:53 PM: success Building production JavaScript and CSS bundles โ 33.539 s
9:14:57 PM: error Cannot read property 'path' of undefined
9:14:57 PM:
9:14:57 PM: TypeError: Cannot read property 'path' of undefined
9:14:57 PM:
9:14:57 PM: - build.js:68 buildHTML.catch.err
9:14:57 PM: [repo]/[gatsby]/dist/commands/build.js:68:72
9:14:57 PM:
9:14:57 PM: - util.js:16 tryCatcher
9:14:57 PM: [repo]/[bluebird]/js/release/util.js:16:23
9:14:57 PM:
9:14:57 PM: - promise.js:512 Promise._settlePromiseFromHandler
9:14:57 PM: [repo]/[bluebird]/js/release/promise.js:512:31
9:14:57 PM:
9:14:57 PM: - promise.js:569 Promise._settlePromise
9:14:57 PM: [repo]/[bluebird]/js/release/promise.js:569:18
9:14:57 PM:
9:14:57 PM: - promise.js:614 Promise._settlePromise0
9:14:57 PM: [repo]/[bluebird]/js/release/promise.js:614:10
9:14:57 PM:
9:14:57 PM: - promise.js:690 Promise._settlePromises
9:14:57 PM: [repo]/[bluebird]/js/release/promise.js:690:18
9:14:57 PM:
9:14:57 PM: - async.js:138 _drainQueueStep
9:14:57 PM: [repo]/[bluebird]/js/release/async.js:138:12
9:14:57 PM:
9:14:57 PM: - async.js:131 _drainQueue
9:14:57 PM: [repo]/[bluebird]/js/release/async.js:131:9
9:14:57 PM:
9:14:57 PM: - async.js:147 Async._drainQueues
9:14:57 PM: [repo]/[bluebird]/js/release/async.js:147:5
9:14:57 PM:
9:14:57 PM: - async.js:17 Immediate.Async.drainQueues [as _onImmediate]
9:14:57 PM: [repo]/[bluebird]/js/release/async.js:17:14
9:14:57 PM:
9:14:57 PM:
9:14:57 PM: error Command failed with exit code 1.
9:14:58 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
9:14:58 PM: Caching artifacts
9:14:58 PM: Started saving node modules
9:14:58 PM: Finished saving node modules
9:14:58 PM: Started saving yarn cache
9:14:58 PM: Finished saving yarn cache
9:14:58 PM: Started saving pip cache
9:14:58 PM: Finished saving pip cache
9:14:58 PM: Started saving emacs cask dependencies
9:14:58 PM: Finished saving emacs cask dependencies
9:14:58 PM: Started saving maven dependencies
9:14:58 PM: Finished saving maven dependencies
9:14:58 PM: Started saving boot dependencies
9:14:58 PM: Finished saving boot dependencies
9:14:58 PM: Started saving go dependencies
9:14:58 PM: Finished saving go dependencies
9:14:58 PM: Cached node version v10.13.0
9:14:58 PM: Error running command: Build script returned non-zero exit code: 1
9:14:58 PM: Failing build: Failed to build site
9:14:58 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
9:14:58 PM: Finished processing build request in 1m38.444547757s
I'm getting the very same stack trace, both on local builds and when deploying to Netlify. No errors in development.
Edit: I've tracked the error down to a third-party package I was using, react-quill. Once removed, it built successfully.
Same issue here!
Sorry about this, @iammatthias, @codeartistrycode and @DiederikvandenB
I've typically seen this happen when some component doesn't support SSR like in https://github.com/gatsbyjs/gatsby/issues/11460. We definitely need to improve errors here so sorry about the confusion!
I didn't get a chance to take a look at your repo yet @iammatthias. Maybe you can try removing imports to a couple of components and see if you can in the mean time?
Thanks, @sidharthachatterjee. If this is connected to SSR, I think that the React-Images alpha is the culprit: https://github.com/jossmac/react-images/issues/199
A user in that thread shared a 'patch-package' fix, so I'll see if that works.
I'll leave this open for now, and report back later if this works or not.
Found a nicer solution than the hacky 'patch-package' fix I mentioned earlier. I dropped the following into my gatsby-node file, and the page is building now.
exports.onCreateWebpackConfig = ({ stage, loaders, actions }) => {
if (stage === 'build-html') {
actions.setWebpackConfig({
module: {
rules: [
{
test: /react-images/,
use: loaders.null(),
},
],
},
})
}
}
Getting the same issue. Probably worth reopening this, as it should be fixed at source instead of requiring a patch in the gatsby config files.
Having this issue as well. Though I don't get the error when building locally. Only when building on netlify. Any update on this, yet? Agree with KingScooty as well, really should be fixed at source.
Also tried the above fix iammathias suggested but still no luck. Below is the error I get on netlify.

@danielvanc so i managed to fix my issue (it was exactly the same error as what's in your screenshot!).
The reporting when doing a gatsby build is quite bad. It's not very helpful.
However, it turned out my issue was i was pulling in a module that was trying to interface with the window. Gatsby blows up as it's not SSR friendly.
I solved this by conditionally requiring the module in componentDidMount() instead of importing it at the top of the file.
i.e:
//...
componentDidMount() {
const clientSideModule = require('./module');
}
Hope that helps!
@danielvanc Do you know what package introduced the issue for you? The fix I posted above was a fix for this issue as caused by the alpha for React-Images.
I'm not sure this is an issue with Gatsby, or really one that Gatsby needs to fix. I think the issue lies with 3rd party packages that have issues with SSR.
Thanks for the info @KingScooty ! In the end, I had to go with the 'fixing 3rd party modules' bit on here https://www.gatsbyjs.org/docs/debugging-html-builds/
The offending module was https://github.com/ntkme/github-buttons
I was trying to add GitHub buttons on my page, took this off and it built okay on netlify. So went with the above and updated my web pack config, pushed to master and it built okay again on netlify.
Should prod the maintainer to see if they can update
@sidharthachatterjee thanks for a good attitude on this, and yes, I think the error reporting needs to become traceable to point. with this kind of error.
I hit it tonight on build after dev, no doubt typically - except my browser references were in style object(!). I was setting a contained element scaled to parent document sizing...had to easter egg before eyes could see this. Thanks be to JetBrains ide's better shelving concept.
The build will fail if the code tries to fetch HTML element data which is not loaded. moving such type of code inside componentDidMount() will help, thanks to @KingScooty
I ran into this issue adding smoothscroll-polyfill to my project. @KingScooty tip helped me resolve the issue. Thanks!
The build will fail if the code tries to fetch HTML element data which is not loaded. moving such type of code inside componentDidMount() will help, thanks to @KingScooty
Can u provide your source code link that u solve this error
Most helpful comment
Thanks for the info @KingScooty ! In the end, I had to go with the 'fixing 3rd party modules' bit on here https://www.gatsbyjs.org/docs/debugging-html-builds/
The offending module was https://github.com/ntkme/github-buttons
I was trying to add GitHub buttons on my page, took this off and it built okay on netlify. So went with the above and updated my web pack config, pushed to master and it built okay again on netlify.
Should prod the maintainer to see if they can update