[Gatsby] Building static HTML failed for path

PLEASE help us help you by writing a good post!
Netlify site name: laughing-meninsky-6e033b

There is an error when trying to build the website, the weird thing is that this is only happening in netlify, when I run npm run build on my computer it works fine. If you need to take a look to the code here it is

Build Logs

7:27:30 PM: Build ready to start
7:27:31 PM: build-image version: 09c2cdcdf242cf2f57c9ee0fcad9d298fad9ad41
7:27:31 PM: build-image tag: v3.5.0
7:27:31 PM: buildbot version: 172aa31cb336bae73f9eb30159b9f95fe46f2e63
7:27:31 PM: Building without cache
7:27:31 PM: Starting to prepare the repo for build
7:27:32 PM: No cached dependencies found. Cloning fresh repo
7:27:32 PM: git clone https://github.com/HugoLiconV/personal-page
7:27:33 PM: Preparing Git Reference refs/heads/master
7:27:34 PM: Starting build script
7:27:35 PM: Installing dependencies
7:27:35 PM: Python version set to 2.7
7:27:36 PM: Downloading and installing node v12.4.0...
7:27:36 PM: Downloading https://nodejs.org/dist/v12.4.0/node-v12.4.0-linux-x64.tar.xz...
7:27:37 PM: Computing checksum with sha256sum
7:27:37 PM: Checksums matched!
7:27:39 PM: Now using node v12.4.0 (npm v6.9.0)
7:27:39 PM: Started restoring cached build plugins
7:27:39 PM: Finished restoring cached build plugins
7:27:39 PM: Attempting ruby version 2.7.1, read from environment
7:27:41 PM: Using ruby version 2.7.1
7:27:41 PM: Using PHP version 5.6
7:27:41 PM: Started restoring cached node modules
7:27:41 PM: Finished restoring cached node modules
7:27:41 PM: Started restoring cached yarn cache
7:27:41 PM: Finished restoring cached yarn cache
7:27:41 PM: Installing yarn at version 1.22.4
7:27:41 PM: Installing Yarn!
7:27:41 PM: > Downloading tarball...
7:27:41 PM: [1/2]: https://yarnpkg.com/downloads/1.22.4/yarn-v1.22.4.tar.gz --> /tmp/yarn.tar.gz.NEPFhYfqFL
7:27:41 PM:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
7:27:41 PM:                                  Dload  Upload   Total   Spent    Left  Speed
7:27:41 PM:   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
7:27:41 PM: 100    80  100    80    0     0    246      0 --:--:-- --:--:-- --:--:--   247
7:27:42 PM: 100    93  100    93    0     0    132      0 --:--:-- --:--:-- --:--:--   132
7:27:42 PM:   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
7:27:42 PM: 100   643  100   643    0     0    651      0 --:--:-- --:--:-- --:--:--  3920
7:27:42 PM: 100 1215k  100 1215k    0     0   857k      0  0:00:01  0:00:01 --:--:--  857k
7:27:42 PM: [2/2]: https://yarnpkg.com/downloads/1.22.4/yarn-v1.22.4.tar.gz.asc --> /tmp/yarn.tar.gz.NEPFhYfqFL.asc
7:27:42 PM: 100    84  100    84    0     0   3107      0 --:--:-- --:--:-- --:--:--  3107
7:27:42 PM: 100    97  100    97    0     0   1782      0 --:--:-- --:--:-- --:--:--  1782
7:27:42 PM: 100   647  100   647    0     0   7388      0 --:--:-- --:--:-- --:--:--  7388
7:27:42 PM: 100  1028  100  1028    0     0   7876      0 --:--:-- --:--:-- --:--:--  7876
7:27:42 PM: > Verifying integrity...
7:27:42 PM: gpg: Signature made Mon 09 Mar 2020 03:52:13 PM UTC using RSA key ID 69475BAA
7:27:42 PM: gpg: Good signature from "Yarn Packaging <yarn@dan.cx>"
7:27:42 PM: gpg: WARNING: This key is not certified with a trusted signature!
7:27:42 PM: gpg:          There is no indication that the signature belongs to the owner.
7:27:42 PM: Primary key fingerprint: 72EC F46A 56B4 AD39 C907  BBB7 1646 B01B 86E5 0310
7:27:42 PM:      Subkey fingerprint: 6D98 490C 6F1A CDDD 448E  4595 4F77 6793 6947 5BAA
7:27:42 PM: > GPG signature looks good
7:27:42 PM: > Extracting to ~/.yarn...
7:27:43 PM: > Adding to $PATH...
7:27:43 PM: > Successfully installed Yarn 1.22.4! Please open another terminal where the `yarn` command will now be available.
7:27:43 PM: Installing NPM modules using Yarn version 1.22.4
7:27:44 PM: yarn install v1.22.4
7:27:44 PM: 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.
7:27:44 PM: [1/4] Resolving packages...
7:27:47 PM: warning gatsby-transformer-remark > remark > unified > @types/vfile > @types/vfile-message@2.0.0: This is a stub types definition. vfile-message provides its own type definitions, so you do not need this installed.
7:27:48 PM: warning netlify-cms-app > netlify-cms-widget-markdown > slate-react > memoize-one@4.1.0: New custom equality api does not play well with all equality helpers. Please use v5.x
7:27:48 PM: [2/4] Fetching packages...
7:27:55 PM: warning url-loader@1.1.2: Invalid bin field for "url-loader".
7:28:32 PM: info fsevents@2.1.3: The platform "linux" is incompatible with this module.
7:28:32 PM: info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
7:28:32 PM: info fsevents@1.2.13: The platform "linux" is incompatible with this module.
7:28:32 PM: info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
7:28:32 PM: [3/4] Linking dependencies...
7:28:32 PM: warning "gatsby > @pmmmwh/react-refresh-webpack-plugin@0.3.3" has incorrect peer dependency "react-refresh@^0.8.2".
7:28:32 PM: warning "gatsby > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
7:28:32 PM: warning "gatsby > gatsby-admin > gatsby-interface@0.0.163" has incorrect peer dependency "gatsby@2.6.0".
7:28:32 PM: warning "gatsby > gatsby-admin > gatsby-interface@0.0.163" has incorrect peer dependency "react@16.8.1".
7:28:32 PM: warning "gatsby > gatsby-admin > gatsby-interface@0.0.163" has incorrect peer dependency "react-dom@16.8.1".
7:28:32 PM: warning "gatsby > gatsby-admin > gatsby-interface@0.0.163" has incorrect peer dependency "yup@^0.27.0".
7:28:32 PM: warning "netlify-cms-app > netlify-cms-widget-code@1.2.4" has unmet peer dependency "codemirror@^5.46.0".
7:28:32 PM: warning "netlify-cms-app > netlify-cms-widget-list@2.8.0" has unmet peer dependency "netlify-cms-lib-widgets@^1.0.0".
7:28:32 PM: warning "netlify-cms-app > netlify-cms-widget-relation@2.8.7" has unmet peer dependency "netlify-cms-lib-widgets@^1.0.0".
7:28:32 PM: warning "netlify-cms-app > netlify-cms-widget-select@2.7.1" has unmet peer dependency "netlify-cms-lib-widgets@^1.0.0".
7:28:32 PM: warning "netlify-cms-app > netlify-cms-core > connected-react-router@6.8.0" has unmet peer dependency "react-router@^4.3.1 || ^5.0.0".
7:28:32 PM: warning "netlify-cms-app > netlify-cms-core > connected-react-router@6.8.0" has unmet peer dependency "seamless-immutable@^7.1.3".
7:28:32 PM: warning "netlify-cms-app > netlify-cms-core > redux-notifications > react-redux@4.4.10" has incorrect peer dependency "redux@^2.0.0 || ^3.0.0".
7:28:32 PM: warning "netlify-cms-app > netlify-cms-widget-code > react-codemirror2@7.2.1" has unmet peer dependency "codemirror@5.x".
7:28:32 PM: warning " > styled-components@5.2.1" has unmet peer dependency "react-is@>= 16.8.0".
7:29:01 PM: [4/4] Building fresh packages...
7:29:10 PM: success Saved lockfile.
7:29:10 PM: Done in 86.42s.
7:29:10 PM: NPM modules installed using Yarn
7:29:10 PM: Started restoring cached go cache
7:29:10 PM: Finished restoring cached go cache
7:29:11 PM: go version go1.14.4 linux/amd64
7:29:11 PM: go version go1.14.4 linux/amd64
7:29:11 PM: Installing missing commands
7:29:11 PM: Verify run directory
7:29:12 PM: ​
7:29:12 PM: ────────────────────────────────────────────────────────────────
7:29:12 PM:   Netlify Build                                                 
7:29:12 PM: ────────────────────────────────────────────────────────────────
7:29:12 PM: ​
7:29:12 PM: ❯ Version
7:29:12 PM:   @netlify/build 5.3.2
7:29:12 PM: ​
7:29:12 PM: ❯ Flags
7:29:12 PM:   deployId: 5fb9cc924c0b4bcead40001e
7:29:12 PM:   mode: buildbot
7:29:12 PM: ​
7:29:12 PM: ❯ Current directory
7:29:12 PM:   /opt/build/repo
7:29:12 PM: ​
7:29:12 PM: ❯ Config file
7:29:12 PM:   /opt/build/repo/netlify.toml
7:29:12 PM: ​
7:29:12 PM: ❯ Context
7:29:12 PM:   production
7:29:12 PM: ​
7:29:12 PM: ❯ Loading plugins
7:29:12 PM:    - netlify-plugin-gatsby-cache@0.3.0 from netlify.toml
7:29:13 PM: ​
7:29:13 PM: ────────────────────────────────────────────────────────────────
7:29:13 PM:   1. onPreBuild command from netlify-plugin-gatsby-cache        
7:29:13 PM: ────────────────────────────────────────────────────────────────
7:29:13 PM: ​
7:29:13 PM: No Gatsby cache found. Building fresh.
7:29:13 PM: ​
7:29:13 PM: (netlify-plugin-gatsby-cache onPreBuild completed in 169ms)
7:29:13 PM: ​
7:29:13 PM: ────────────────────────────────────────────────────────────────
7:29:13 PM:   2. build.command from netlify.toml                            
7:29:13 PM: ────────────────────────────────────────────────────────────────
7:29:13 PM: ​
7:29:13 PM: $ npm run build
7:29:13 PM: > gatsby-starter-default@0.1.0 build /opt/build/repo
7:29:13 PM: > gatsby build
7:29:16 PM: success open and validate gatsby-configs - 0.026s
7:29:17 PM: error Your plugins must export known APIs from their gatsby-node.js.
7:29:17 PM: See https://www.gatsbyjs.org/docs/node-apis/ for the list of Gatsby node APIs.
7:29:17 PM: - The plugin gatsby-transformer-remark@2.11.0 is using the API "unstable_shouldOnCreateNode" which was introduced in gatsby@2.24.80.
7:29:17 PM: - The plugin gatsby-transformer-remark@2.11.0 is using the API "pluginOptionsSchema" which was introduced in gatsby@2.25.0.
7:29:17 PM: - The plugin gatsby-plugin-styled-components@3.5.0 is using the API "pluginOptionsSchema" which was introduced in gatsby@2.25.0.
7:29:17 PM: Some of the following may help fix the error(s):
7:29:17 PM: - npm install gatsby@^2.25.0
7:29:17 PM: - Rename "unstable_shouldOnCreateNode" -> "onCreateNode"
7:29:17 PM: success load plugins - 1.320s
7:29:17 PM: success onPreInit - 0.014s
7:29:17 PM: success delete html and css files from previous builds - 0.011s
7:29:17 PM: success initialize cache - 0.008s
7:29:17 PM: success copy gatsby files - 0.048s
7:29:17 PM: success onPreBootstrap - 0.007s
7:29:17 PM: success createSchemaCustomization - 0.007s
7:29:17 PM: success source and transform nodes - 0.135s
7:29:18 PM: success building schema - 0.347s
7:29:18 PM: success createPages - 0.039s
7:29:18 PM: success createPagesStatefully - 0.090s
7:29:18 PM: success onPreExtractQueries - 0.000s
7:29:18 PM: success update schema - 0.023s
7:29:18 PM: success extract queries from components - 0.410s
7:29:18 PM: success write out requires - 0.004s
7:29:18 PM: success write out redirect data - 0.001s
7:29:19 PM: success Build manifest and related icons - 0.276s
7:29:19 PM: success onPostBootstrap - 0.278s
7:29:19 PM: β €
7:29:19 PM: info bootstrap finished - 5.211s
7:29:19 PM: β €
7:29:20 PM: warning Browserslist: caniuse-lite is outdated. Please run:
7:29:20 PM: npx browserslist@latest --update-db
7:29:47 PM: warning "export 'default' (imported as 'Helmet') was not found in 'react-helmet'success Building production JavaScript and CSS bundles - 28.198s
7:29:47 PM: success Rewriting compilation hashes - 0.001s
7:29:48 PM: success run queries - 28.959s - 12/12 0.41/s
7:29:50 PM: failed Building static HTML for pages - 2.378s
7:29:50 PM: error Building static HTML failed for path "/notes/the-missing-semester-of-your-cs-education"
7:29:50 PM: 
7:29:50 PM: 
7:29:50 PM:   WebpackError: Minified React error #130; visit https://reactjs.org/docs/error-  decoder.html?invariant=130&args[]=undefined&args[]= for the full message or us  e the non-minified dev environment for full errors and additional helpful warn  ings.
7:29:50 PM:   
7:29:50 PM:   - build-html.js:110 doBuildPages
7:29:50 PM:     [repo]/[gatsby]/dist/commands/build-html.js:110:24
7:29:50 PM:   
7:29:50 PM:   - build-html.js:124 async buildHTML
7:29:50 PM:     [repo]/[gatsby]/dist/commands/build-html.js:124:3
7:29:50 PM:   
7:29:50 PM:   - build.js:200 async build
7:29:50 PM:     [repo]/[gatsby]/dist/commands/build.js:200:5
7:29:50 PM:   
7:29:50 PM: 
7:29:50 PM: not finished Generating image thumbnails - 31.361s
7:29:50 PM: npm ERR! code ELIFECYCLE
7:29:50 PM: npm ERR! errno 1
7:29:50 PM: npm ERR! gatsby-starter-default@0.1.0 build: `gatsby build`
7:29:50 PM: npm ERR! Exit status 1
7:29:50 PM: npm ERR!
7:29:50 PM: npm ERR! Failed at the gatsby-starter-default@0.1.0 build script.
7:29:50 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
7:29:50 PM: npm ERR! A complete log of this run can be found in:
7:29:50 PM: npm ERR!     /opt/buildhome/.npm/_logs/2020-11-22T02_29_50_585Z-debug.log
7:29:50 PM: ​
7:29:50 PM: ────────────────────────────────────────────────────────────────
7:29:50 PM:   "build.command" failed                                        
7:29:50 PM: ────────────────────────────────────────────────────────────────
7:29:50 PM: ​
7:29:50 PM:   Error message
7:29:50 PM:   Command failed with exit code 1: npm run build
7:29:50 PM: ​
7:29:50 PM:   Error location
7:29:50 PM:   In build.command from netlify.toml:
7:29:50 PM:   npm run build
7:29:50 PM: ​
7:29:50 PM:   Resolved config
7:29:50 PM:   build:
7:29:50 PM:     command: npm run build
7:29:50 PM:     commandOrigin: config
7:29:50 PM:     environment:
7:29:50 PM:       - NODE_VERSION
7:29:50 PM:     publish: /opt/build/repo/public
7:29:50 PM:   plugins:
7:29:50 PM:     - inputs: {}
7:29:50 PM:       origin: config
7:29:50 PM:       package: netlify-plugin-gatsby-cache
7:29:50 PM: Caching artifacts
7:29:50 PM: Started saving node modules
7:29:50 PM: Finished saving node modules
7:29:50 PM: Started saving build plugins
7:29:50 PM: Finished saving build plugins
7:29:50 PM: Started saving yarn cache
7:29:50 PM: Finished saving yarn cache
7:29:50 PM: Started saving pip cache
7:29:50 PM: Finished saving pip cache
7:29:50 PM: Started saving emacs cask dependencies
7:29:50 PM: Finished saving emacs cask dependencies
7:29:50 PM: Started saving maven dependencies
7:29:50 PM: Finished saving maven dependencies
7:29:50 PM: Started saving boot dependencies
7:29:50 PM: Finished saving boot dependencies
7:29:50 PM: Started saving go dependencies
7:29:50 PM: Finished saving go dependencies
7:29:54 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
7:29:54 PM: Failing build: Failed to build site
7:29:54 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
7:29:54 PM: Finished processing build request in 2m22.468922996s

Thanks for sharing the repo. It got so easy to find the error in one go.

In your /src/templates/blog-post.js, change line 2 from import Helmet from "react-helmet" to import { Helmet } from "react-helmet" and it works.

1 Like

It worked. The weird thing is that this error was only happening on Netlify, on my computer was working fine. Anyways, thanks for the help

Yeah, it happened the same for me. But I had faced the exact same issue few months back, so happened to knew the workaround.