question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error deploying to Netlify:

See original GitHub issue

I sourced my Gatsby site with Prismic.io and locally everything works well. The problem is when I am trying to deploy it to Netlify I get the following error:


4:03:17 PM: Build ready to start
4:03:40 PM: build-image version: 2dbd444fcdce00cf06325060a8238d5ae3e86774
4:03:40 PM: build-image tag: v3.3.7
4:03:40 PM: buildbot version: bd31cf433d2d899021d41733f271c39fdf2f8880
4:03:40 PM: Fetching cached dependencies
4:03:40 PM: Failed to fetch cache, continuing with build
4:03:40 PM: Starting to prepare the repo for build
4:03:40 PM: No cached dependencies found. Cloning fresh repo
4:03:40 PM: git clone https://github.com/leonstern10/udemy-course-prismic
4:03:41 PM: Preparing Git Reference refs/heads/master
4:03:42 PM: Starting build script
4:03:42 PM: Installing dependencies
4:03:44 PM: v10.19.0 is already installed.
4:03:44 PM: Now using node v10.19.0 (npm v6.13.4)
4:03:45 PM: Attempting ruby version 2.6.2, read from environment
4:03:46 PM: Using ruby version 2.6.2
4:03:46 PM: Using PHP version 5.6
4:03:46 PM: Started restoring cached node modules
4:03:47 PM: Finished restoring cached node modules
4:03:47 PM: Installing NPM modules using NPM version 6.13.4
4:04:36 PM: > sharp@0.23.4 install /opt/build/repo/node_modules/sharp
4:04:36 PM: > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
4:04:36 PM: info
4:04:36 PM: sharp
4:04:36 PM:  Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.8.1/libvips-8.8.1-linux-x64.tar.gz
4:04:39 PM: > core-js@2.6.11 postinstall /opt/build/repo/node_modules/core-js
4:04:39 PM: > node -e "try{require('./postinstall')}catch(e){}"
4:04:39 PM: Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
4:04:39 PM: The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
4:04:39 PM: > https://opencollective.com/core-js 
4:04:39 PM: > https://www.patreon.com/zloirock 
4:04:39 PM: Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
4:04:39 PM: > core-js-pure@3.6.4 postinstall /opt/build/repo/node_modules/core-js-pure
4:04:39 PM: > node -e "try{require('./postinstall')}catch(e){}"
4:04:39 PM: > gatsby-telemetry@1.1.56 postinstall /opt/build/repo/node_modules/gatsby-telemetry
4:04:39 PM: > node src/postinstall.js || true
4:04:40 PM: > cwebp-bin@5.1.0 postinstall /opt/build/repo/node_modules/cwebp-bin
4:04:40 PM: > node lib/install.js
4:04:40 PM:   ✔ cwebp pre-build test passed successfully
4:04:40 PM: > mozjpeg@6.0.1 postinstall /opt/build/repo/node_modules/mozjpeg
4:04:40 PM: > node lib/install.js
4:04:41 PM:   ✔ mozjpeg pre-build test passed successfully
4:04:41 PM: > pngquant-bin@5.0.2 postinstall /opt/build/repo/node_modules/pngquant-bin
4:04:41 PM: > node lib/install.js
4:04:41 PM:   ✔ pngquant pre-build test passed successfully
4:04:41 PM: > gatsby-cli@2.10.11 postinstall /opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli
4:04:41 PM: > node scripts/postinstall.js
4:04:41 PM: > gatsby@2.19.45 postinstall /opt/build/repo/node_modules/gatsby
4:04:41 PM: > node scripts/postinstall.js
4:04:45 PM: npm
4:04:45 PM:  WARN optional
4:04:45 PM:  SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/fsevents):
4:04:45 PM: npm
4:04:45 PM:  WARN notsup
4:04:45 PM:  SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
4:04:45 PM: npm
4:04:45 PM:  WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/chokidar/node_modules/fsevents):
4:04:45 PM: npm WARN
4:04:45 PM:  notsup
4:04:45 PM:  SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
4:04:45 PM: added 2087 packages from 971 contributors and audited 28903 packages in 55.897s
4:04:47 PM: 58 packages are looking for funding
4:04:47 PM:   run `npm fund` for details
4:04:47 PM: found 52 vulnerabilities (43 low, 9 high)
4:04:47 PM:   run `npm audit fix` to fix them, or `npm audit` for details
4:04:47 PM: NPM modules installed
4:04:47 PM: Started restoring cached go cache
4:04:47 PM: Finished restoring cached go cache
4:04:47 PM: unset GOOS;
4:04:47 PM: unset GOARCH;
4:04:47 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
4:04:47 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
4:04:47 PM: go version >&2;
4:04:47 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
4:04:48 PM: go version go1.12 linux/amd64
4:04:48 PM: Installing missing commands
4:04:48 PM: Verify run directory
4:04:48 PM: Executing user command: gatsby build
4:04:51 PM: success open and validate gatsby-configs - 0.085s
4:04:52 PM: success load plugins - 1.004s
4:04:52 PM: success onPreInit - 0.017s
4:04:52 PM: success delete html and css files from previous builds - 0.024s
4:04:52 PM: success initialize cache - 0.013s
4:04:52 PM: success copy gatsby files - 0.039s
4:04:52 PM: success onPreBootstrap - 0.008s
4:04:52 PM: success createSchemaCustomization - 0.006s
4:04:59 PM: success source and transform nodes - 6.737s
4:04:59 PM: success building schema - 0.472s
4:05:00 PM: success createPages - 0.490s
4:05:00 PM: success createPagesStatefully - 0.112s
4:05:00 PM: success onPreExtractQueries - 0.001s
4:05:00 PM: success update schema - 0.099s
4:05:00 PM: success extract queries from components - 0.709s
4:05:00 PM: success write out requires - 0.004s
4:05:00 PM: success write out redirect data - 0.001s
4:05:01 PM: success Build manifest and related icons - 0.389s
4:05:01 PM: success onPostBootstrap - 0.394s
4:05:01 PM: ⠀
4:05:01 PM: info bootstrap finished - 13.270 s
4:05:01 PM: ⠀
4:05:36 PM: failed Building production JavaScript and CSS bundles - 34.464s
4:05:36 PM: error Generating JavaScript bundles failed
4:05:36 PM: /opt/build/repo/src/components/layout.js: Duplicate declaration "staticQueryData" (This is an error on an internal node. Probably an internal error.)
4:05:36 PM: not finished run queries - 34.804s
4:05:36 PM: not finished Generating image thumbnails - 34.750s
4:05:36 PM: Skipping functions preparation step: no functions directory set
4:05:36 PM: Caching artifacts
4:05:36 PM: Started saving node modules
4:05:36 PM: Finished saving node modules
4:05:36 PM: Started saving pip cache
4:05:36 PM: Finished saving pip cache
4:05:36 PM: Started saving emacs cask dependencies
4:05:36 PM: Finished saving emacs cask dependencies
4:05:36 PM: Started saving maven dependencies
4:05:36 PM: Finished saving maven dependencies
4:05:36 PM: Started saving boot dependencies
4:05:36 PM: Finished saving boot dependencies
4:05:36 PM: Started saving go dependencies
4:05:36 PM: Finished saving go dependencies
4:05:40 PM: Error running command: Build script returned non-zero exit code: 1
4:05:40 PM: Failing build: Failed to build site
4:05:40 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
4:05:40 PM: Finished processing build request in 2m0.456870851s

Steps to reproduce

This is my repository: https://github.com/leonstern10/udemy-course-prismic

I hope you can help me! Thanks

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
jonniebigodescommented, Apr 3, 2020

@leonstern10 i’ve picked up on you issue and it seems that your issue lies with the layout component. Inside it you have multiple StaticQuery and that’s a Gatsby limitation. You can only have one StaticQuery per component/file. This link refers to the hook approach of the static query, but the same applies for StaticQuery component. The good news is that you already have the query in place so no changes there, so you would only need to remove the second StaticQuery component for the Footer and you should be good to go.

A quick tip for you, before deploying to Netlify or any other host, issue a gatsby build && gatsby serve to generate a local production build and emulate a production server so that you can see if everything is in working order with your site so that you don’t run into some issues.

Feel free to provide feedback so that we can close this issue, or continue to work on it until we find a suitable solution.

0reactions
jonniebigodescommented, Apr 4, 2020

@leonstern10 no need to thank. Glad that i was able to help you solve your issue. Going to close it as per your instructions

Read more comments on GitHub >

github_iconTop Results From Across the Web

Build troubleshooting tips - Netlify Docs
Typically this means that we don't have permission to clone the repository you are trying to deploy. The usual cause for this is...
Read more >
Deploy failed Netlify - Stack Overflow
Go to: Site settings > Build & deploy > Build image selection > Edit settings. · Choose Ubuntu Xenial 16.05. · Save and...
Read more >
2 ways to overcome deployment problems with React on Netlify
How to deploy a project on Netlify · Problems while deploying. Solution 1: Change scripts in package.json; Solution 2: Change key on Netlify ......
Read more >
How to Deploy a React Router App to Netlify and Fix the ...
Have you ever experienced a “PAGE NOT FOUND” error when trying to access or refresh an application that uses React Router?
Read more >
prismicio/client export error deploying to Netlify - Prismic People
However, when I try to deploy to Netlify, I get the following error message, and the build fails: 3:04:15 PM: generating static routes...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found