gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.26k stars 10.31k forks source link

Production error/fail on netlify/gatsby cloud after adding gatsby-sitemap plugin #29338

Closed wad-im closed 3 years ago

wad-im commented 3 years ago

Description

After adding the gatsby sitemap plugin to my project, the production on netlify (and on gatsby cloud) throw an error.

My local build works as expected and does not throw any error.

I consider myself a beginner and do not understand the error and how to solve it. I'd appreciate your help. I am not sure whether the error is with adding the sitemap plugin. The error on gatsby cloud was thrown also before the plugin, but only after adding the plugin, netlify yielded an error, too.

Steps to reproduce

Not sure what the error is about to reproduce. I can share the repo, if it helps.

How to Make a Minimal Reproduction: https://www.gatsbyjs.com/contributing/how-to-make-a-reproducible-test-case/

Expected result

A successful build on netlify (and on gatsby cloud) and the sitemap successfully added.

Actual result

The build fails and throws the following error: 
9:00:18 AM: Build ready to start
9:00:20 AM: build-image version: d84c79427e8f83c1ba17bcdd7b3fe38059376b68
9:00:20 AM: build-image tag: v3.6.1
9:00:20 AM: buildbot version: d35018babe252245044d3565f193fa426818b4b1
9:00:20 AM: Building without cache
9:00:20 AM: Starting to prepare the repo for build
9:00:20 AM: No cached dependencies found. Cloning fresh repo
9:00:20 AM: git clone https://github.com/wad-im/bognasPortfolio
9:00:21 AM: Preparing Git Reference refs/heads/main
9:00:23 AM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'public' versus 'public/' in the Netlify UI
9:00:23 AM: Starting build script
9:00:23 AM: Installing dependencies
9:00:23 AM: Python version set to 2.7
9:00:24 AM: v12.18.0 is already installed.
9:00:25 AM: Now using node v12.18.0 (npm v6.14.4)
9:00:25 AM: Started restoring cached build plugins
9:00:25 AM: Finished restoring cached build plugins
9:00:25 AM: Attempting ruby version 2.7.1, read from environment
9:00:27 AM: Using ruby version 2.7.1
9:00:27 AM: Using PHP version 5.6
9:00:27 AM: Started restoring cached node modules
9:00:27 AM: Finished restoring cached node modules
9:00:28 AM: Installing NPM modules using NPM version 6.14.4
9:01:19 AM: npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
9:01:19 AM: > sharp@0.27.1 install /opt/build/repo/node_modules/gatsby-plugin-manifest/node_modules/sharp
9:01:19 AM: > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
9:01:20 AM: info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.10.5/libvips-8.10.5-linux-x64.tar.br
9:01:22 AM: > sharp@0.27.1 install /opt/build/repo/node_modules/gatsby-plugin-sharp/node_modules/sharp
9:01:22 AM: > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
9:01:23 AM: info sharp Using cached /opt/buildhome/.npm/_libvips/libvips-8.10.5-linux-x64.tar.br
9:01:25 AM: > sharp@0.27.1 install /opt/build/repo/node_modules/gatsby-transformer-sharp/node_modules/sharp
9:01:25 AM: > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
9:01:26 AM: info sharp Using cached /opt/buildhome/.npm/_libvips/libvips-8.10.5-linux-x64.tar.br
9:01:28 AM: > puppeteer@3.3.0 install /opt/build/repo/node_modules/puppeteer
9:01:28 AM: > node install.js
9:01:37 AM: Chromium (756035) downloaded to /opt/build/repo/node_modules/puppeteer/.local-chromium/linux-756035
9:01:37 AM: > core-js@2.6.12 postinstall /opt/build/repo/node_modules/babel-runtime/node_modules/core-js
9:01:37 AM: > node -e "try{require('./postinstall')}catch(e){}"
9:01:38 AM: > core-js@3.8.3 postinstall /opt/build/repo/node_modules/core-js
9:01:38 AM: > node -e "try{require('./postinstall')}catch(e){}"
9:01:38 AM: > core-js-pure@3.8.3 postinstall /opt/build/repo/node_modules/core-js-pure
9:01:38 AM: > node -e "try{require('./postinstall')}catch(e){}"
9:01:39 AM: > gatsby-telemetry@1.10.0 postinstall /opt/build/repo/node_modules/gatsby-telemetry
9:01:39 AM: > node src/postinstall.js || true
9:01:39 AM: > mozjpeg@7.0.0 postinstall /opt/build/repo/node_modules/mozjpeg
9:01:39 AM: > node lib/install.js
9:01:40 AM:   ✔ mozjpeg pre-build test passed successfully
9:01:40 AM: > pngquant-bin@6.0.0 postinstall /opt/build/repo/node_modules/pngquant-bin
9:01:40 AM: > node lib/install.js
9:01:40 AM:   ✔ pngquant pre-build test passed successfully
9:01:40 AM: > gatsby-cli@2.19.1 postinstall /opt/build/repo/node_modules/gatsby-cli
9:01:40 AM: > node scripts/postinstall.js
9:01:40 AM: > gatsby@2.32.2 postinstall /opt/build/repo/node_modules/gatsby
9:01:40 AM: > node scripts/postinstall.js
9:01:43 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/webpack-dev-server/node_modules/fsevents):
9:01:43 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
9:01:43 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
9:01:43 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
9:01:43 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.1 (node_modules/fsevents):
9:01:43 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
9:01:43 AM: added 2521 packages from 1401 contributors and audited 2528 packages in 74.911s
9:01:46 AM: 180 packages are looking for funding
9:01:46 AM:   run `npm fund` for details
9:01:46 AM: found 2 vulnerabilities (1 low, 1 high)
9:01:46 AM:   run `npm audit fix` to fix them, or `npm audit` for details
9:01:46 AM: NPM modules installed
9:01:47 AM: Started restoring cached go cache
9:01:47 AM: Finished restoring cached go cache
9:01:47 AM: go version go1.14.4 linux/amd64
9:01:47 AM: go version go1.14.4 linux/amd64
9:01:47 AM: Installing missing commands
9:01:47 AM: Verify run directory
9:01:48 AM: ​
9:01:48 AM: ────────────────────────────────────────────────────────────────
9:01:48 AM:   Netlify Build                                                 
9:01:48 AM: ────────────────────────────────────────────────────────────────
9:01:48 AM: ​
9:01:48 AM: ❯ Version
9:01:48 AM:   @netlify/build 9.0.0
9:01:48 AM: ​
9:01:48 AM: ❯ Flags
9:01:48 AM:   deployId: 601cfb120aa75daa6194c76c
9:01:48 AM:   mode: buildbot
9:01:48 AM: ​
9:01:48 AM: ❯ Current directory
9:01:48 AM:   /opt/build/repo
9:01:48 AM: ​
9:01:48 AM: ❯ Config file
9:01:48 AM:   No config file was defined: using default values.
9:01:48 AM: ​
9:01:48 AM: ❯ Context
9:01:48 AM:   production
9:01:48 AM: ​
9:01:48 AM: ────────────────────────────────────────────────────────────────
9:01:48 AM:   1. Build command from Netlify app                             
9:01:48 AM: ────────────────────────────────────────────────────────────────
9:01:48 AM: ​
9:01:48 AM: $ npm run build
9:01:49 AM: > bognas-portfolio@1.0.0 build /opt/build/repo
9:01:49 AM: > gatsby build
9:01:52 AM: success open and validate gatsby-configs - 0.058s
9:01:53 AM: success load plugins - 1.110s
9:01:53 AM: success onPreInit - 0.039s
9:01:53 AM: success delete html and css files from previous builds - 0.003s
9:01:53 AM: success initialize cache - 0.005s
9:01:53 AM: success copy gatsby files - 0.046s
9:01:53 AM: success onPreBootstrap - 0.022s
9:01:53 AM: success createSchemaCustomization - 0.006s
9:01:54 AM: success Contentful: Sync all items - 0.063s - 14/14 223.68/s
9:01:54 AM: success Contentful: Fetch data (3izr731s7l9v-master) - 0.238s
9:01:54 AM: info Updated entries 6
9:01:54 AM: info Deleted entries 0
9:01:54 AM: info Updated assets 8
9:01:54 AM: info Deleted assets 0
9:01:54 AM: success Contentful: Process data (3izr731s7l9v-master) - 0.015s
9:01:54 AM: info Creating 6 Contentful Project nodes
9:01:54 AM: info Creating 8 Contentful asset nodes
9:01:54 AM: success Contentful: Create nodes (3izr731s7l9v-master) - 0.011s
9:01:54 AM: success Checking for changed pages - 0.000s
9:01:54 AM: success source and transform nodes - 0.453s
9:01:54 AM: warning Thank you for trying the beta version of the `gatsbyImageData` API. Please provide feedback and report any issues at: https://github.com/gatsbyjs/gatsby/discussions/27950
9:01:54 AM: success building schema - 0.457s
9:01:54 AM: info Total nodes: 60, SitePage nodes: 2 (use --verbose for breakdown)
9:01:54 AM: success createPages - 0.009s
9:01:54 AM: success Checking for changed pages - 0.000s
9:01:54 AM: success createPagesStatefully - 0.088s
9:01:54 AM: success update schema - 0.028s
9:01:54 AM: success onPreExtractQueries - 0.001s
9:01:56 AM: success extract queries from components - 1.614s
9:01:56 AM: success write out redirect data - 0.001s
9:01:56 AM: success Build manifest and related icons - 0.176s
9:01:56 AM: success onPostBootstrap - 0.178s
9:01:56 AM: info bootstrap finished - 7.341s
9:01:56 AM: success run static queries - 0.138s - 4/4 28.92/s
9:01:56 AM: success run page queries - 0.008s - 6/6 725.96/s
9:01:56 AM: success write out requires - 0.005s
9:02:18 AM: failed Building production JavaScript and CSS bundles - 21.992s
9:02:18 AM: error Generating JavaScript bundles failed
9:02:18 AM: Can't resolve 'react-is' in '/opt/build/repo/node_modules/styled-components/dist'
9:02:18 AM: If you're trying to use a package make sure that 'react-is' is installed. If you're trying to use a local file make sure that the path is correct.
9:02:18 AM: npm ERR! code ELIFECYCLE
9:02:18 AM: npm ERR! errno 1
9:02:18 AM: npm ERR! bognas-portfolio@1.0.0 build: `gatsby build`
9:02:18 AM: npm ERR! Exit status 1
9:02:18 AM: npm ERR!
9:02:18 AM: npm ERR! Failed at the bognas-portfolio@1.0.0 build script.
9:02:18 AM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
9:02:18 AM: npm ERR! A complete log of this run can be found in:
9:02:18 AM: npm ERR!     /opt/buildhome/.npm/_logs/2021-02-05T08_02_18_828Z-debug.log
9:02:18 AM: ​
9:02:18 AM: ────────────────────────────────────────────────────────────────
9:02:18 AM:   "build.command" failed                                        
9:02:18 AM: ────────────────────────────────────────────────────────────────
9:02:18 AM: ​
9:02:18 AM:   Error message
9:02:18 AM:   Command failed with exit code 1: npm run build
9:02:18 AM: ​
9:02:18 AM:   Error location
9:02:18 AM:   In Build command from Netlify app:
9:02:18 AM:   npm run build
9:02:18 AM: ​
9:02:18 AM:   Resolved config
9:02:18 AM:   build:
9:02:18 AM:     command: npm run build
9:02:18 AM:     commandOrigin: ui
9:02:18 AM:     environment:
9:02:18 AM:       - CONTENTFUL_ACCESS_TOKEN
9:02:18 AM:       - CONTENTFUL_SPACE_ID
9:02:18 AM:       - TYPEKIT_ID
9:02:18 AM:     publish: /opt/build/repo/public
9:02:18 AM: Caching artifacts
9:02:18 AM: Started saving node modules
9:02:18 AM: Finished saving node modules
9:02:18 AM: Started saving build plugins
9:02:18 AM: Finished saving build plugins
9:02:18 AM: Started saving pip cache
9:02:19 AM: Finished saving pip cache
9:02:19 AM: Started saving emacs cask dependencies
9:02:19 AM: Finished saving emacs cask dependencies
9:02:19 AM: Started saving maven dependencies
9:02:19 AM: Finished saving maven dependencies
9:02:19 AM: Started saving boot dependencies
9:02:19 AM: Finished saving boot dependencies
9:02:19 AM: Started saving rust rustup cache
9:02:19 AM: Finished saving rust rustup cache
9:02:19 AM: Started saving go dependencies
9:02:19 AM: Finished saving go dependencies
9:02:21 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
9:02:21 AM: Failing build: Failed to build site
9:02:22 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2
9:02:22 AM: Finished processing build request in 2m1.923517984s

and gatsby cloud throws the following error (the cloud error existed also before, while on netlify there was not error):

Generating JavaScript bundles failed at node_modules/styled-components/dist/styled-components.browser.esm.js

Environment

  System:
    OS: Windows 10 10.0.18363
    CPU: (4) x64 Intel(R) Core(TM) i3-7100U CPU @ 2.40GHz
  Binaries:
    Node: 15.7.0 - C:\Program Files\nodejs\node.EXE
    npm: 7.4.3 - C:\Program Files\nodejs\npm.CMD
  Languages:
    Python: 3.9.1
  Browsers:
    Chrome: 88.0.4324.104
    Edge: Spartan (44.18362.449.0)
  npmPackages:
    gatsby: ^2.31.1 => 2.32.2
    gatsby-image: ^2.10.0 => 2.11.0
    gatsby-plugin-manifest: ^2.12.0 => 2.12.0
    gatsby-plugin-offline: ^3.10.0 => 3.10.0
    gatsby-plugin-preload-fonts: ^1.8.0 => 1.9.0
    gatsby-plugin-react-helmet: ^3.9.0 => 3.10.0
    gatsby-plugin-sharp: ^2.13.1 => 2.14.0
    gatsby-plugin-sitemap: ^2.12.0 => 2.12.0
    gatsby-plugin-styled-components: ^3.9.0 => 3.10.0
    gatsby-plugin-web-font-loader: ^1.0.4 => 1.0.4
    gatsby-source-contentful: ^4.5.1 => 4.6.0
    gatsby-source-filesystem: ^2.10.0 => 2.11.0
    gatsby-transformer-sharp: ^2.11.0 => 2.12.0
  npmGlobalPackages:
    gatsby-cli: 2.16.1
wad-im commented 3 years ago

When I uninstall the gatsby sitemap plugin, I do not get any build error on netlify anymore. Yet, if I install the google analytics plugin, the same error appears, too. So the issue does not seem to lie with the plugins.