failed Building static HTML for pages, Building static HTML failed for path "/"
See original GitHub issuePreliminary Checks
- This issue is not a duplicate. Before opening a new issue, please search existing issues: https://github.com/gatsbyjs/gatsby/issues
- This issue is not a question, feature request, RFC, or anything other than a bug report directly related to Gatsby. Please post those things in GitHub Discussions: https://github.com/gatsbyjs/gatsby/discussions
Description
I am getting this error when i am trying to build my gatsby site. βgatsby buildβ. Note that it works fine on βgatsby developβ.
Reproduction Link
https://github.com/Azlanburney/dcwebtech.git
Steps to Reproduce
npm run build
Expected Result
to made build for the site.
Actual Result
9:51:03 PM: Build ready to start
9:51:05 PM: build-image version: 7e10faf349e7a42e522e4b38297aec45774c71a6 (focal)
9:51:05 PM: build-image tag: v4.4.1
9:51:05 PM: buildbot version: 3ad9e2b8c8724536407d9ecdc2e63c359c783c56
9:51:05 PM: Building without cache
9:51:05 PM: Starting to prepare the repo for build
9:51:06 PM: No cached dependencies found. Cloning fresh repo
9:51:06 PM: git clone https://github.com/Azlanburney/dcwebtech
9:51:14 PM: Preparing Git Reference refs/heads/master
9:51:16 PM: Parsing package.json dependencies
9:51:17 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'public' versus 'public/' in the Netlify UI
9:51:17 PM: Starting build script
9:51:17 PM: Installing dependencies
9:51:17 PM: Python version set to 2.7
9:51:18 PM: v16.13.0 is already installed.
9:51:18 PM: Now using node v16.13.0 (npm v8.1.0)
9:51:18 PM: Started restoring cached build plugins
9:51:18 PM: Finished restoring cached build plugins
9:51:19 PM: Attempting ruby version 2.7.2, read from environment
9:51:20 PM: Using ruby version 2.7.2
9:51:20 PM: Using PHP version 8.0
9:51:20 PM: Started restoring cached node modules
9:51:20 PM: Finished restoring cached node modules
9:51:21 PM: Installing NPM modules using NPM version 8.1.0
9:51:24 PM: npm WARN old lockfile
9:51:24 PM: npm WARN old lockfile The package-lock.json file was created with an old version of npm,
9:51:24 PM: npm WARN old lockfile so supplemental metadata must be fetched from the registry.
9:51:24 PM: npm WARN old lockfile
9:51:24 PM: npm WARN old lockfile This is a one-time fix-up, please be patient...
9:51:24 PM: npm WARN old lockfile
9:51:58 PM: npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
9:51:58 PM: npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
9:52:00 PM: npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
9:52:00 PM: npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
9:52:00 PM: npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
9:52:00 PM: npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
9:52:03 PM: npm WARN deprecated querystring@0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
9:52:15 PM: npm WARN deprecated @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.
9:52:17 PM: npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
9:52:17 PM: npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained
9:52:18 PM: npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
9:52:18 PM: npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
9:52:20 PM: npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
9:52:24 PM: npm WARN deprecated @hapi/joi@15.1.1: Switch to 'npm install joi'
9:52:29 PM: npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
9:52:50 PM: added 2318 packages, and audited 2319 packages in 1m
9:52:50 PM: 319 packages are looking for funding
9:52:50 PM: run `npm fund` for details
9:52:50 PM: 44 vulnerabilities (10 moderate, 32 high, 2 critical)
9:52:50 PM: To address issues that do not require attention, run:
9:52:50 PM: npm audit fix
9:52:50 PM: To address all issues (including breaking changes), run:
9:52:50 PM: npm audit fix --force
9:52:50 PM: Run `npm audit` for details.
9:52:50 PM: NPM modules installed
9:52:50 PM: Started restoring cached go cache
9:52:50 PM: Finished restoring cached go cache
9:52:50 PM: go version go1.16.5 linux/amd64
9:52:50 PM: go version go1.16.5 linux/amd64
9:52:50 PM: Installing missing commands
9:52:50 PM: Verify run directory
9:52:52 PM: β
9:52:52 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
9:52:52 PM: Netlify Build
9:52:52 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
9:52:52 PM: β
9:52:52 PM: β― Version
9:52:52 PM: @netlify/build 18.21.8
9:52:52 PM: β
9:52:52 PM: β― Flags
9:52:52 PM: baseRelDir: true
9:52:52 PM: buildId: 618bf8771ee3c360a7e54422
9:52:52 PM: deployId: 618bf8771ee3c360a7e54424
9:52:52 PM: β
9:52:52 PM: β― Current directory
9:52:52 PM: /opt/build/repo
9:52:52 PM: β
9:52:52 PM: β― Config file
9:52:52 PM: No config file was defined: using default values.
9:52:52 PM: β
9:52:52 PM: β― Context
9:52:52 PM: production
9:52:52 PM: β
9:52:52 PM: β― Installing plugins
9:52:52 PM: - @netlify/plugin-gatsby@1.0.3
9:52:58 PM: β
9:52:58 PM: β― Loading plugins
9:52:58 PM: - @netlify/plugin-gatsby@1.0.3 from Netlify app
9:52:58 PM: β
9:52:58 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
9:52:58 PM: 1. @netlify/plugin-gatsby (onPreBuild event)
9:52:58 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
9:52:58 PM: β
9:52:58 PM: No Gatsby cache found. Building fresh.
9:52:58 PM: Add `gatsby-plugin-netlify` to `gatsby-config.js` if you would like to support Gatsby redirects. π
9:52:58 PM: β
9:52:58 PM: (@netlify/plugin-gatsby onPreBuild completed in 198ms)
9:52:58 PM: β
9:52:58 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
9:52:58 PM: 2. Build command from Netlify app
9:52:58 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
9:52:58 PM: β
9:52:58 PM: $ npm run build
9:52:59 PM: > onitir@0.1.0 build
9:52:59 PM: > gatsby build
9:53:02 PM: success open and validate gatsby-configs, load plugins - 0.279s
9:53:02 PM: warning The netlify-cms package is deprecated, please install netlify-cms-app instead. You can do this by running "npm install netlify-cms-app"
9:53:02 PM: success onPreInit - 0.014s
9:53:02 PM: success initialize cache - 0.055s
9:53:02 PM: success copy gatsby files - 0.424s
9:53:03 PM: success Compiling Gatsby Functions - 0.444s
9:53:03 PM: success onPreBootstrap - 0.460s
9:53:03 PM: success createSchemaCustomization - 0.001s
9:53:03 PM: success Checking for changed pages - 0.000s
9:53:03 PM: success source and transform nodes - 0.432s
9:53:03 PM: info Writing GraphQL type definitions to /opt/build/repo/.cache/schema.gql
9:53:05 PM: success building schema - 1.309s
9:53:05 PM: success createPages - 0.000s
9:53:05 PM: success createPagesStatefully - 0.206s
9:53:05 PM: info Total nodes: 21, SitePage nodes: 2 (use --verbose for breakdown)
9:53:05 PM: success Checking for changed pages - 0.000s
9:53:05 PM: success Cleaning up stale page-data - 0.007s
9:53:05 PM: success onPreExtractQueries - 0.000s
9:53:05 PM: success extract queries from components - 0.394s
9:53:05 PM: success write out redirect data - 0.007s
9:53:05 PM: success onPostBootstrap - 0.000s
9:53:05 PM: info bootstrap finished - 6.328s
9:53:05 PM: success write out requires - 0.009s
9:54:37 PM: success Building production JavaScript and CSS bundles - 91.400s
9:55:17 PM: success Building HTML renderer - 40.302s
9:55:17 PM: success Execute page configs - 0.100s
9:55:17 PM: success Caching Webpack compilations - 0.003s
9:55:17 PM: success run queries in workers - 0.017s - 0/0 0.00/s
9:55:17 PM: success Merge worker state - 0.002s
9:55:17 PM: success Rewriting compilation hashes - 0.171s
9:55:17 PM: success Writing page-data.json files to public directory - 0.010s - 1/2 192.00/s
9:55:22 PM: error Page data from page-data.json for the failed page "/": {
9:55:22 PM: "componentChunkName": "component---src-pages-index-js",
9:55:22 PM: "path": "/",
9:55:22 PM: "result": {
9:55:22 PM: "pageContext": {}
9:55:22 PM: },
9:55:22 PM: "staticQueryHashes": []
9:55:22 PM: }
9:55:22 PM: failed Building static HTML for pages - 4.947s
9:55:22 PM: error Building static HTML failed for path "/"
9:55:22 PM:
9:55:22 PM: 6 | }
9:55:22 PM: 7 | if (isProduction) {
9:55:22 PM: > 8 | throw new Error(prefix);
9:55:22 PM: | ^
9:55:22 PM: 9 | }
9:55:22 PM: 10 | throw new Error(prefix + ": " + (message || ''));
9:55:22 PM: 11 | }
9:55:22 PM:
9:55:22 PM: WebpackError: Invariant failed
9:55:22 PM:
9:55:22 PM: - tiny-invariant.esm.js:8
9:55:22 PM: [onitir]/[tiny-invariant]/dist/tiny-invariant.esm.js:8:1
9:55:22 PM:
9:55:22 PM: - history.js:250
9:55:22 PM: [onitir]/[history]/esm/history.js:250:115
9:55:22 PM:
9:55:22 PM: - react-router-dom.js:29
9:55:22 PM: [onitir]/[react-router-dom]/esm/react-router-dom.js:29:41
9:55:22 PM:
9:55:22 PM: - index.js:26
9:55:22 PM: [onitir]/[classnames]/index.js:26:1
9:55:22 PM:
9:55:22 PM: - index.js:29
9:55:22 PM: [onitir]/[classnames]/index.js:29:6
9:55:22 PM:
9:55:22 PM: - index.js:35
9:55:22 PM: [onitir]/[classnames]/index.js:35:1
9:55:22 PM:
9:55:22 PM: - index.js:34
9:55:22 PM: [onitir]/[classnames]/index.js:34:1
9:55:22 PM:
9:55:22 PM: - index.js:45
9:55:22 PM: [onitir]/[classnames]/index.js:45:1
9:55:22 PM:
9:55:22 PM: - static-entry.js:297
9:55:22 PM: onitir/.cache/static-entry.js:297:22
9:55:22 PM:
9:55:22 PM: - history.js:157
9:55:22 PM: [onitir]/[@gatsbyjs]/reach-router/es/lib/history.js:157:1
9:55:22 PM:
9:55:22 PM:
9:55:23 PM: β
9:55:23 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
9:55:23 PM: "build.command" failed
9:55:23 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
9:55:23 PM: β
9:55:23 PM: Error message
9:55:23 PM: Command failed with exit code 1: npm run build
9:55:23 PM: β
9:55:23 PM: Error location
9:55:23 PM: In Build command from Netlify app:
9:55:23 PM: npm run build
9:55:23 PM: β
9:55:23 PM: Resolved config
9:55:23 PM: build:
9:55:23 PM: command: npm run build
9:55:23 PM: commandOrigin: ui
9:55:23 PM: publish: /opt/build/repo/public
9:55:23 PM: publishOrigin: ui
9:55:23 PM: plugins:
9:55:23 PM: - inputs: {}
9:55:23 PM: origin: ui
9:55:23 PM: package: '@netlify/plugin-gatsby'
9:55:23 PM: Caching artifacts
9:55:23 PM: Started saving node modules
9:55:23 PM: Finished saving node modules
9:55:23 PM: Started saving build plugins
9:55:23 PM: Finished saving build plugins
9:55:23 PM: Started saving pip cache
9:55:23 PM: Finished saving pip cache
9:55:23 PM: Started saving emacs cask dependencies
9:55:23 PM: Finished saving emacs cask dependencies
9:55:23 PM: Started saving maven dependencies
9:55:23 PM: Finished saving maven dependencies
9:55:23 PM: Started saving boot dependencies
9:55:23 PM: Finished saving boot dependencies
9:55:23 PM: Started saving rust rustup cache
9:55:23 PM: Finished saving rust rustup cache
9:55:23 PM: Started saving go dependencies
9:55:23 PM: Finished saving go dependencies
9:55:26 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
9:55:26 PM: Creating deploy upload records
9:55:26 PM: Failing build: Failed to build site
9:55:26 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
9:55:26 PM: Finished processing build request in 4m20.822424582s
Environment
System:
OS: Linux 5.4 Linux Mint 20.1 (Ulyssa)
CPU: (4) x64 Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 14.18.0 - /usr/local/bin/node
npm: 6.14.15 - /usr/local/bin/npm
Browsers:
Chrome: 94.0.4606.71
Firefox: 92.0.1
npmPackages:
gatsby: ^4.1.0 => 4.1.0
gatsby-cli: ^4.1.2 => 4.1.2
gatsby-plugin-google-fonts: ^1.0.1 => 1.0.1
gatsby-plugin-netlify-cms: ^6.1.0 => 6.1.0
gatsby-plugin-styled-components: ^5.1.0 => 5.1.0
Config Flags
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Error Building static HTML failed for path "/home/" Β· Issue #22594
Description. `Building static HTML failed for path "/404/". See our docs page for more info on this error: https://gatsby.dev/debug-html.
Read more >Building static HTML failed for path "/styles/" - Gatsby ...
cache , this file showed me the error was coming from @emotion trying to compile the src/pages/styles.js file that is used by index-old.js...
Read more >Building static HTML failed for path - Developing with Prismic
Hello,. we have an issue with gatsby build . The issue only happens with gatsby build , gatsby develop is working fine. The...
Read more >[Gatsby] Building static HTML failed for path - Support
[Gatsby] Building static HTML failed for path ... There is an error when trying to build the website, the weird thing is that...
Read more >Debugging HTML Builds | Gatsby
Some other reason :-) #1 is the most common reason building static files fail. If it's another reason, you have to be a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
A couple of things here. I was able to get past that error by removing the React.lazy calls and Suspense. You really donβt need those very often when building a static site with Gatsby. The main reason would be code-splitting, but again, thatβs not common. Secondly, you donβt need to be using Router here the way you are. Gatsby already comes with a router, and the way you are using it could be replaced by creating pages under
src/pages/mypage.js
. Lastly, you are using some jQuery libraries that expect window to be defined. You will have to be careful that these are not called during SSR, when window is undefined. Here are some helpful links for these issues. As this is not a bug, I am closing this one, thanks!https://www.gatsbyjs.com/docs/how-code-splitting-works/ https://www.gatsbyjs.com/docs/how-to/routing/creating-routes/#creating-individual-pages https://www.gatsbyjs.com/docs/reach-router-and-gatsby/#gatsby-skip-here
Note to others saying they are also seeing this error, please open separate reports with reproductions, as I donβt believe they are related to any issue I saw here. This error is a pretty generic one that can be debugged starting with this document: https://www.gatsbyjs.com/docs/debugging-html-builds/.
Thanks!
It looks like the example is using React.lazy and Suspense with React 17, I wonder if that is relevant to the reproduction.