I’ve recently updated some plugins on my Gatsby website. It works fine locally but it is failing the deploy on Netlify.
The error I’m getting is:
"build.command" failed – Command was killed with SIGSEGV (Segmentation fault): gatsby build.
I’m thinking that some of the plugin updates might be the cause.
Thanks for your help!
Netlify deploy log:
3:25:55 PM: Build ready to start
3:25:57 PM: build-image version: 53b83b6bede2920f236b25b6f5a95334320dc849
3:25:57 PM: build-image tag: v3.6.0
3:25:57 PM: buildbot version: 8ae026ef4905d9174e416775c6b64aa19950569b
3:25:57 PM: Fetching cached dependencies
3:25:57 PM: Starting to download cache of 835.8MB
3:26:04 PM: Finished downloading cache in 7.766503086s
3:26:04 PM: Starting to extract cache
3:26:22 PM: Finished extracting cache in 17.591359336s
3:26:22 PM: Finished fetching cache in 25.565252333s
3:26:22 PM: Starting to prepare the repo for build
3:26:23 PM: Preparing Git Reference refs/heads/master
3:26:28 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'public' versus 'public/' in the Netlify UI
3:26:28 PM: Starting build script
3:26:28 PM: Installing dependencies
3:26:28 PM: Python version set to 2.7
3:26:29 PM: Started restoring cached node version
3:26:32 PM: Finished restoring cached node version
3:26:33 PM: v10.23.0 is already installed.
3:26:33 PM: Now using node v10.23.0 (npm v6.14.8)
3:26:33 PM: Started restoring cached build plugins
3:26:33 PM: Finished restoring cached build plugins
3:26:34 PM: Attempting ruby version 2.6.2, read from environment
3:26:35 PM: Using ruby version 2.6.2
3:26:35 PM: Using PHP version 5.6
3:26:35 PM: Started restoring cached node modules
3:26:35 PM: Finished restoring cached node modules
3:26:36 PM: Installing NPM modules using NPM version 6.14.8
3:27:00 PM: > [email protected] install /opt/build/repo/node_modules/gatsby-plugin-sharp/node_modules/sharp
3:27:00 PM: > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
3:27:01 PM: info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.10.0/libvips-8.10.0-linux-x64.tar.br
3:27:04 PM: > [email protected] install /opt/build/repo/node_modules/gatsby-transformer-sharp/node_modules/sharp
3:27:04 PM: > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
3:27:05 PM: info sharp Using cached /opt/buildhome/.npm/_libvips/libvips-8.10.0-linux-x64.tar.br
3:27:06 PM: > [email protected] postinstall /opt/build/repo/node_modules/babel-runtime/node_modules/core-js
3:27:06 PM: > node -e "try{require('./postinstall')}catch(e){}"
3:27:06 PM: > [email protected] postinstall /opt/build/repo/node_modules/core-js
3:27:06 PM: > node -e "try{require('./postinstall')}catch(e){}"
3:27:06 PM: > [email protected] postinstall /opt/build/repo/node_modules/core-js-pure
3:27:06 PM: > node -e "try{require('./postinstall')}catch(e){}"
3:27:06 PM: > [email protected] postinstall /opt/build/repo/node_modules/gatsby-telemetry
3:27:06 PM: > node src/postinstall.js || true
3:27:06 PM: > [email protected] postinstall /opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli
3:27:06 PM: > node scripts/postinstall.js
3:27:07 PM: > [email protected] postinstall /opt/build/repo/node_modules/gatsby
3:27:07 PM: > node scripts/postinstall.js
3:27:09 PM: npm WARN @tailwindcss/[email protected] requires a peer of tailwindcss@^1.0 but none is installed. You must install peer dependencies yourself.
3:27:09 PM: npm WARN [email protected] requires a peer of 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 but none is installed. You must install peer dependencies yourself.
3:27:09 PM: npm WARN [email protected] No description
3:27:09 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
3:27:09 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
3:27:09 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/chokidar/node_modules/fsevents):
3:27:09 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
3:27:09 PM: added 321 packages from 167 contributors, removed 112 packages, updated 208 packages and audited 2568 packages in 32.574s
3:27:11 PM: 173 packages are looking for funding
3:27:11 PM: run `npm fund` for details
3:27:11 PM: found 0 vulnerabilities
3:27:11 PM: NPM modules installed
3:27:11 PM: Started restoring cached go cache
3:27:13 PM: Finished restoring cached go cache
3:27:13 PM: Installing Go version 1.12
3:27:13 PM: unset GOOS;
3:27:13 PM: unset GOARCH;
3:27:13 PM: export GOROOT='/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64';
3:27:13 PM: export PATH="/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64/bin:${PATH}";
3:27:13 PM: go version >&2;
3:27:13 PM: export GIMME_ENV='/opt/buildhome/.gimme_cache/env/go1.12.linux.amd64.env';
3:27:13 PM: go version go1.12 linux/amd64
3:27:13 PM: Installing missing commands
3:27:13 PM: Verify run directory
3:27:15 PM:
3:27:15 PM: ────────────────────────────────────────────────────────────────
3:27:15 PM: Netlify Build
3:27:15 PM: ────────────────────────────────────────────────────────────────
3:27:15 PM:
3:27:15 PM: ❯ Version
3:27:15 PM: @netlify/build 8.0.0
3:27:15 PM:
3:27:15 PM: ❯ Flags
3:27:15 PM: deployId: 5fe9f9033720d60008993f0a
3:27:15 PM: mode: buildbot
3:27:15 PM:
3:27:15 PM: ❯ Current directory
3:27:15 PM: /opt/build/repo
3:27:15 PM:
3:27:15 PM: ❯ Config file
3:27:15 PM: No config file was defined: using default values.
3:27:15 PM:
3:27:15 PM: ❯ Context
3:27:15 PM: production
3:27:15 PM:
3:27:15 PM: ────────────────────────────────────────────────────────────────
3:27:15 PM: 1. Build command from Netlify app
3:27:15 PM: ────────────────────────────────────────────────────────────────
3:27:15 PM:
3:27:15 PM: $ gatsby build
3:27:18 PM: success open and validate gatsby-configs - 0.413s
3:27:19 PM: success load plugins - 0.923s
3:27:19 PM: success onPreInit - 0.037s
3:27:19 PM: success delete html and css files from previous builds - 0.007s
3:27:19 PM: success initialize cache - 0.005s
3:27:19 PM: success copy gatsby files - 0.043s
3:27:19 PM: success onPreBootstrap - 0.021s
3:27:19 PM: success createSchemaCustomization - 0.035s
3:27:20 PM: success Checking for changed pages - 0.000s
3:27:20 PM: success source and transform nodes - 0.793s
3:27:20 PM: success building schema - 0.374s
3:27:20 PM: info Total nodes: 267, SitePage nodes: 2 (use --verbose for breakdown)
3:27:20 PM: success createPages - 0.005s
3:27:20 PM: success Checking for changed pages - 0.000s
3:27:20 PM: success createPagesStatefully - 0.092s
3:27:20 PM: success Cleaning up stale page-data - 0.001s
3:27:20 PM: success update schema - 0.017s
3:27:20 PM: success onPreExtractQueries - 0.000s
3:27:21 PM: success extract queries from components - 0.502s
3:27:21 PM: success write out redirect data - 0.001s
3:27:21 PM: vips_value_hash: no case for NULL
3:27:21 PM: type 64, gchararray
3:27:21 PM: generic 53, GParamString
3:27:21 PM: vips_value_hash: no case for 0.000000
3:27:21 PM: type 60, gdouble
3:27:21 PM: generic 109, GParamDouble
3:27:21 PM: vips_value_hash: no case for FALSE
3:27:21 PM: type 20, gboolean
3:27:21 PM: generic 76, GParamBoolean
3:27:21 PM: vips_value_hash: no case for ((VipsAccess) VIPS_ACCESS_RANDOM)
3:27:21 PM: type 81740352, VipsAccess
3:27:21 PM: generic 80, GParamEnum
3:27:21 PM: vips_value_hash: no case for FALSE
3:27:21 PM: type 20, gboolean
3:27:21 PM: generic 76, GParamBoolean
3:27:22 PM:
3:27:22 PM: ────────────────────────────────────────────────────────────────
3:27:22 PM: "build.command" failed
3:27:22 PM: ────────────────────────────────────────────────────────────────
3:27:22 PM:
3:27:22 PM: Error message
3:27:22 PM: Command was killed with SIGSEGV (Segmentation fault): gatsby build
3:27:22 PM:
3:27:22 PM: Error location
3:27:22 PM: In Build command from Netlify app:
3:27:22 PM: gatsby build
3:27:22 PM:
3:27:22 PM: Resolved config
3:27:22 PM: build:
3:27:22 PM: command: gatsby build
3:27:22 PM: commandOrigin: ui
3:27:22 PM: publish: /opt/build/repo/public
3:27:22 PM: Caching artifacts
3:27:22 PM: Started saving node modules
3:27:22 PM: Finished saving node modules
3:27:22 PM: Started saving build plugins
3:27:22 PM: Finished saving build plugins
3:27:22 PM: Started saving pip cache
3:27:22 PM: Finished saving pip cache
3:27:22 PM: Started saving emacs cask dependencies
3:27:22 PM: Finished saving emacs cask dependencies
3:27:22 PM: Started saving maven dependencies
3:27:22 PM: Finished saving maven dependencies
3:27:22 PM: Started saving boot dependencies
3:27:22 PM: Finished saving boot dependencies
3:27:22 PM: Started saving rust rustup cache
3:27:22 PM: Finished saving rust rustup cache
3:27:22 PM: Started saving rust cargo bin cache
3:27:22 PM: Finished saving rust cargo bin cache
3:27:22 PM: Started saving go dependencies
3:27:23 PM: Finished saving go dependencies
3:27:23 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
3:27:23 PM: Failing build: Failed to build site
3:27:23 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
3:27:23 PM: Finished processing build request in 1m26.932707149s
Package.json
{
"scripts": {
"analyze:lint": "eslint --ext .jsx --ext .js .",
"analyze:prettier": "prettier --list-different "**/*.{css,js,jsx,json,md}"",
"analyze": "npm run analyze:lint && npm run analyze:prettier",
"fix:lint": "eslint --ext .jsx --ext .js . --fix",
"fix:prettier": "prettier --write "**/*.{css,js,jsx,json,md}"",
"fix": "npm run fix:lint && npm run fix:prettier",
"build": "gatsby build",
"develop": "gatsby develop --open",
"dev": "npm run develop",
"start": "npm run develop",
"serve": "gatsby serve",
"clean": "gatsby clean",
"test": "echo "Write tests! -> https://gatsby.dev/unit-testing" && exit 1"
},
"dependencies": {
"babel-plugin-styled-components": "^1.10.7",
"gatsby": "^2.29.2",
"gatsby-image": "^2.8.0",
"gatsby-image-background-slider": "0.0.4",
"gatsby-plugin-google-analytics": "^2.3.17",
"gatsby-plugin-hotjar": "^1.1.1",
"gatsby-plugin-layout": "^1.7.0",
"gatsby-plugin-manifest": "2.4.1",
"gatsby-plugin-offline": "3.2.0",
"gatsby-plugin-postcss": "^3.4.0",
"gatsby-plugin-react-helmet": "3.7.0",
"gatsby-plugin-sharp": "^2.11.2",
"gatsby-plugin-sitemap": "^2.9.0",
"gatsby-plugin-styled-components": "^3.3.1",
"gatsby-plugin-web-font-loader": "^1.0.4",
"gatsby-source-filesystem": "^2.3.29",
"gatsby-transformer-sharp": "^2.9.0",
"postcss": "^8.2.1",
"prop-types": "15.7.2",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-helmet": "6.0.0",
"react-intersection-observer": "^8.26.2",
"react-player": "^2.0.1",
"react-select": "^3.1.0",
"react-spring": "^8.0.27",
"styled-components": "^5.1.0"
},
"devDependencies": {
"@tailwindcss/custom-forms": "0.2.1",
"autoprefixer": "^9.0.0",
"babel-eslint": "10.1.0",
"cssnano": "4.1.10",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
"eslint-loader": "3.0.4",
"eslint-plugin-import": "2.20.2",
"eslint-plugin-react": "7.19.0",
"gatsby-plugin-eslint": "2.0.8",
"prettier": "2.0.5",
"react-moment": "^0.9.7",
"tailwindcss": "^2.0.2"
},
"keywords": [
],
"license": "MIT",
"repository": {
"type": "git",
"url": ""
}
}
2
Answers
This kind of issue is related to mismatching versions of Node between your local environment and Netlify’s one since all your packages are installed in
node_modules
based on your Node version and Netlify’s does the same so, there are a couple of things you can do to fix it:Reverse your last changes of
package-lock.json
oryarn-lock.json
to get the previous working version. Once it’s done, remove yournode_modules
folder and reinstall your dependencies again.Setting the same version of Node in both environments; you can use
node -v
locally to get your working version there (assuming that is building properly in your local machine) and manage the build dependencies to set the same version in Netlify’s side.Force the manual upgrade of the dependencies by running:
Test the local environment by using
netlify-cli
will be helpful to check where the issue is locatedFix:
yarn upgrade gatsby-plugin-manifest@latest gatsby-plugin-sharp@latest
How I got here:
P.S. I also tried changing/upgrading my Node version, as an answer suggested, but that didn’t work.