Netlify build Error using create-react-app (CRA) website - reactjs

Getting: Build script returned non-zero exit code: 1
I have deployed my react js website code through Netlify and getting a build log and error as follows:
10:37:15 AM: Build ready to start
10:37:16 AM: build-image version: 42bca793ccd33055023c56c4ca8510463a56d317
10:37:17 AM: buildbot version: 6bab8b64bbd90091082af19fedf16bf73d502e5e
10:37:17 AM: Fetching cached dependencies
10:37:17 AM: Failed to fetch cache, continuing with build
10:37:17 AM: Starting to prepare the repo for build
10:37:17 AM: No cached dependencies found. Cloning fresh repo
10:37:17 AM: git clone git#github.com:justtabhi/react-blog-exambunker
10:37:19 AM: Preparing Git Reference refs/heads/master
10:37:20 AM: Starting build script
10:37:20 AM: Installing dependencies
10:37:21 AM: Downloading and installing node v8.12.0...
10:37:21 AM: Downloading https://nodejs.org/dist/v8.12.0/node-v8.12.0-linux-x64.tar.xz...
10:37:21 AM:
#
10:37:21 AM: 1.6%
10:37:22 AM:
#############################
10:37:22 AM: 40.8%
10:37:22 AM:
#####################################
10:37:22 AM: ################################### 100.0%
10:37:22 AM: Computing checksum with sha256sum
10:37:22 AM: Checksums matched!
10:37:24 AM: Now using node v8.12.0 (npm v6.4.1)
10:37:24 AM: Attempting ruby version 2.3.6, read from environment
10:37:25 AM: Using ruby version 2.3.6
10:37:26 AM: Using PHP version 5.6
10:37:26 AM: Started restoring cached node modules
10:37:26 AM: Finished restoring cached node modules
10:37:26 AM: Installing NPM modules using NPM version 6.4.1
10:37:53 AM: > uglifyjs-webpack-plugin#0.4.6 postinstall
/opt/build/repo/node_modules/uglifyjs-webpack-plugin
10:37:53 AM: > node lib/post_install.js
10:37:55 AM: npm
10:37:55 AM: WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4 (node_modules/fsevents):
10:37:55 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
10:37:55 AM: added 1280 packages from 735 contributors and audited 12827
packages in 28.118s
10:37:55 AM: found 0 vulnerabilities
10:37:55 AM: NPM modules installed
10:37:55 AM: Started restoring cached go cache
10:37:55 AM: Finished restoring cached go cache
10:37:55 AM: unset GOOS;
10:37:55 AM: unset GOARCH;
10:37:55 AM: export GOROOT='/opt/buildhome/.gimme/versions/go1.10.linux.amd64';
10:37:55 AM: export PATH="/opt/buildhome/.gimme/versions/go1.10.linux.amd64/bin:${PATH}";
10:37:55 AM: go version >&2;
10:37:55 AM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.10.linux.amd64.env';
10:37:55 AM: go version go1.10 linux/amd64
10:37:55 AM: Installing missing commands
10:37:55 AM: Verify run directory
10:37:55 AM: Executing user command: npm run build
10:37:55 AM: > react-blog#0.1.0 build /opt/build/repo
10:37:55 AM: > react-scripts build`enter code here`
10:37:57 AM: Creating an optimized production build...
10:38:02 AM: Failed to compile.
10:38:02 AM: Failed to minify the code from this file:
10:38:02 AM: ./node_modules/indicative/builds/main.js:1:52673
10:38:02 AM: npm ERR! code ELIFECYCLE
10:38:02 AM: npm ERR! errno 1
10:38:02 AM: npm ERR! react-blog#0.1.0 build: `react-scripts build`
10:38:02 AM: npm ERR! Exit status 1
10:38:02 AM: npm ERR!
10:38:02 AM: npm ERR! Failed at the react-blog#0.1.0 build script.
10:38:02 AM: npm ERR! This is probably not a problem with npm. There is likely
additional logging output above.
10:38:02 AM: npm ERR! A complete log of this run can be found in:
10:38:02 AM: npm ERR! /opt/buildhome/.npm/_logs/2018-09-25T05_08_02_457Z-
debug.log
10:38:02 AM: Caching artifacts
10:38:02 AM: Started saving node modules
10:38:02 AM: Finished saving node modules
10:38:02 AM: Started saving pip cache
10:38:02 AM: Finished saving pip cache
10:38:02 AM: Started saving emacs cask dependencies
10:38:02 AM: Finished saving emacs cask dependencies
10:38:02 AM: Started saving maven dependencies
10:38:02 AM: Finished saving maven dependencies
10:38:02 AM: Started saving boot dependencies
10:38:02 AM: Finished saving boot dependencies
10:38:02 AM: Started saving go dependencies
10:38:02 AM: Finished saving go dependencies
10:38:03 AM: Cached node version v8.12.0
10:38:03 AM: Error running command: Build script returned non-zero exit code: 1
10:38:03 AM: Failing build: Failed to build site
10:38:03 AM: failed during stage 'building site': Build script returned non-zero
exit code: 1
10:38:03 AM: Finished processing build request in 46.262986678s
Please someone suggest what might have gone wrong here??

The issue here is caused by the build environment using react-scripts in your create-react-app. You have a node_modules package being imported that is in an unexpected bundle format.
When running your npm run build in local development, which is what is happening on Netlify, you will see the following error on your build:
Failed to minify the code from this file:
./node_modules/indicative/builds/main.js:1:52673
Read more here: http:// bit.ly/2tRViJ9
As explained in the link (http:// bit.ly/2tRViJ9), react-scripts need to upgrade to react-scripts#>=2.0.0
$ npm install react-scripts#^2.0.0
In the previous version (<2.0.0), react-scripts did not support ES.Next features found in node_modules. It expected CommonJS or ES and recommended to compile to ES5 for older browsers. Now the builds will allow you to Set target browsers and use ES.Next features.
Once you confirm that the build local has no errors you can push these changes to your git repository and your Netlify build should also work.
NOTE: When using Netlify as your CI/CD solution, it is a good practice to make sure to run your build command during local development prior to pushing your changes to your master target branch to make sure there are not any issues with your production build.

Related

react-google-login npm package error in version of react#"^18.2.0" from the root project

I'm getting error in react-google-login npm package here i've shown build code
10:50:18 AM: Build ready to start
10:50:21 AM: build-image version: 72a309a113b53ef075815b129953617827965e48 (focal)
10:50:21 AM: build-image tag: v4.8.2
10:50:21 AM: buildbot version: 515e5c33287d8b909c004fcf2e460e8645e8c1c6
10:50:21 AM: Fetching cached dependencies
10:50:21 AM: Failed to fetch cache, continuing with build
10:50:21 AM: Starting to prepare the repo for build
10:50:21 AM: No cached dependencies found. Cloning fresh repo
10:50:21 AM: git clone https://github.com/abhidadhaniya23/xlinks-client
10:50:22 AM: Preparing Git Reference refs/heads/master
10:50:22 AM: Parsing package.json dependencies
10:50:23 AM: Starting build script
10:50:23 AM: Installing dependencies
10:50:23 AM: Python version set to 2.7
10:50:24 AM: v16.15.1 is already installed.
10:50:25 AM: Now using node v16.15.1 (npm v8.11.0)
10:50:25 AM: Started restoring cached build plugins
10:50:25 AM: Finished restoring cached build plugins
10:50:25 AM: Attempting ruby version 2.7.2, read from environment
10:50:26 AM: Using ruby version 2.7.2
10:50:26 AM: Using PHP version 8.0
10:50:27 AM: No npm workspaces detected
10:50:27 AM: Started restoring cached node modules
10:50:27 AM: Finished restoring cached node modules
10:50:27 AM: Installing NPM modules using NPM version 8.11.0
10:50:27 AM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
10:50:27 AM: npm WARN config location in the cache, and they are managed by
10:50:27 AM: npm WARN config [`cacache`](http://npm.im/cacache).
10:50:28 AM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
10:50:28 AM: npm WARN config location in the cache, and they are managed by
10:50:28 AM: npm WARN config [`cacache`](http://npm.im/cacache).
10:50:30 AM: npm ERR! code ERESOLVE
10:50:30 AM: npm ERR! ERESOLVE could not resolve
10:50:30 AM: npm ERR!
10:50:30 AM: npm ERR! While resolving: react-google-login#5.2.2
10:50:30 AM: Creating deploy upload records
10:50:30 AM: npm ERR! Found: react#18.2.0
10:50:30 AM: npm ERR! node_modules/react
10:50:30 AM: npm ERR! react#"^18.2.0" from the root project
10:50:30 AM: npm ERR! peer react#"^18.0.0" from #testing-library/react#13.3.0
10:50:30 AM: npm ERR! node_modules/#testing-library/react
10:50:30 AM: Failed during stage 'building site': Build script returned non-zero exit code: 1 (https://ntl.fyi/exit-code-1)
10:50:30 AM: npm ERR! #testing-library/react#"^13.3.0" from the root project
10:50:30 AM: npm ERR! 2 more (react-dom, react-scripts)
10:50:30 AM: npm ERR!
10:50:30 AM: npm ERR! Could not resolve dependency:
10:50:30 AM: npm ERR! peer react#"^16 || ^17" from react-google-login#5.2.2
10:50:30 AM: npm ERR! node_modules/react-google-login
10:50:30 AM: npm ERR! react-google-login#"^5.2.2" from the root project
10:50:30 AM: npm ERR!
10:50:30 AM: npm ERR! Conflicting peer dependency: react#17.0.2
10:50:30 AM: npm ERR! node_modules/react
10:50:30 AM: npm ERR! peer react#"^16 || ^17" from react-google-login#5.2.2
10:50:30 AM: npm ERR! node_modules/react-google-login
10:50:30 AM: npm ERR! react-google-login#"^5.2.2" from the root project
10:50:30 AM: npm ERR!
10:50:30 AM: npm ERR! Fix the upstream dependency conflict, or retry
10:50:30 AM: npm ERR! this command with --force, or --legacy-peer-deps
10:50:30 AM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
10:50:30 AM: npm ERR!
10:50:30 AM: npm ERR! See /opt/buildhome/.npm/eresolve-report.txt for a full report.
10:50:30 AM: npm ERR! A complete log of this run can be found in:
10:50:30 AM: npm ERR! /opt/buildhome/.npm/_logs/2022-07-01T05_20_28_238Z-debug-0.log
10:50:30 AM: Error during NPM install
10:50:30 AM: Build was terminated: Build script returned non-zero exit code: 1
10:50:30 AM: Failing build: Failed to build site
10:50:30 AM: Finished processing build request in 9.18683257s
I've also tried npm install react-google-login --legacy-peer-deps command to install react-google-login but still build failed in netlify building process.
This log, I've atteched from netlify build.
When I install packages using npm install it shows 6 high severity vulnerabilities

Yarn Install fails due to non existing file

I am deploying a site to netlify.
The site deployed fine until I installed react-player using npm install react-player
There were a number of critical errors that I tried to fix.
The site builds fine locally using yarn run build and it runs fine locally doing npm start.
But when I deploy it to netlify I get an error with Yarn Install that shows the following
5:21:48 AM: Build ready to start
5:21:50 AM: build-image version: 73def8bb10593b9b818f44989a75ea508018ccb7 (focal)
5:21:50 AM: build-image tag: v4.5.2
5:21:50 AM: buildbot version: 8cd320132979d1a1a502e85e77b47b97cc7d659f
5:21:50 AM: Fetching cached dependencies
5:21:50 AM: Starting to download cache of 237.2MB
5:21:52 AM: Finished downloading cache in 2.467525285s
5:21:52 AM: Starting to extract cache
5:22:00 AM: Finished extracting cache in 7.81313843s
5:22:00 AM: Finished fetching cache in 10.326357005s
5:22:00 AM: Starting to prepare the repo for build
5:22:01 AM: Preparing Git Reference refs/heads/main
5:22:02 AM: Parsing package.json dependencies
5:22:03 AM: Starting build script
5:22:03 AM: Installing dependencies
5:22:03 AM: Python version set to 2.7
5:22:03 AM: Started restoring cached node version
5:22:05 AM: Finished restoring cached node version
5:22:05 AM: v16.13.2 is already installed.
5:22:06 AM: Now using node v16.13.2 (npm v8.1.2)
5:22:06 AM: Started restoring cached build plugins
5:22:06 AM: Finished restoring cached build plugins
5:22:06 AM: Attempting ruby version 2.7.2, read from environment
5:22:07 AM: Using ruby version 2.7.2
5:22:07 AM: Using PHP version 8.0
5:22:07 AM: Started restoring cached yarn cache
5:22:12 AM: Finished restoring cached yarn cache
5:22:13 AM: No yarn workspaces detected
5:22:13 AM: Started restoring cached node modules
5:22:13 AM: Finished restoring cached node modules
5:22:13 AM: Installing NPM modules using Yarn version 1.22.10
5:22:14 AM: yarn install v1.22.10
5:22:14 AM: 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.
5:22:14 AM: [1/4] Resolving packages...
5:22:15 AM: warning react-scripts > fsevents#2.1.2: "Please update to latest v2.3 or v2.2"
5:22:15 AM: warning react-scripts > webpack-dev-server > chokidar > fsevents#1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
5:22:15 AM: warning react-scripts > babel-jest > #jest/transform > jest-haste-map > fsevents#1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
5:22:15 AM: error Package "chokidar2" refers to a non-existing file '"/opt/build/repo/chokidar2"'.
5:22:15 AM: info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
5:22:15 AM: Error during Yarn install
5:22:15 AM: Build was terminated: Build script returned non-zero exit code: 1
5:22:15 AM: Creating deploy upload records
5:22:15 AM: Failing build: Failed to build site
5:22:15 AM: Failed during stage 'building site': Build script returned non-zero exit code: 1
5:22:15 AM: Finished processing build request in 25.380006101s
I am not sure how to approach solving this error. I have checked a number of similar posts such as npm install fails, yarn install succeeds on netlify deploy but I am not finding a good solution.
Thanks for your help
the issue was in the yarn.lock file. It was referring to chokidar2 which was not working.
I removed the yarn.lock file and my node modules folder.
Then I ran yarn cache clean
then I reran yarn install to reinstall node modules
Then I ran yarn run build
and reuploaded everything to git with the new build

" Dependencies installation error" : Is Netlify asking for a previous version of node to deploy the site?

While deploying my app with Netlify I am getting this error
Dependencies installation error
Is it asking me to install a previous version of node locally and redeploy it?
`10:25:19 AM: Dependencies installation error
10:25:19 AM: ────────────────────────────────────────────────────────────────
10:25:19 AM: ​
10:25:19 AM: Error message
10:25:19 AM: A Netlify Function is using "firebase-functions" but that dependency has not been installed yet.
10:25:19 AM: ​
10:25:19 AM: By default, dependencies inside a Netlify Function's "package.json" are not automatically installed.
There are several ways to fix this problem:
10:25:19 AM: - Removing your Function's "package.json" and adding the dependencies to the project's top-level "package.json" instead. This is the fastest and safest solution.
10:25:19 AM: - Running "npm install" or "yarn" inside your Netlify Function in your build command.
10:25:19 AM: - Adding the following plugin to your "netlify.toml":
10:25:19 AM: ​
10:25:19 AM: [[plugins]]
10:25:19 AM: package = "#netlify/plugin-functions-install-core"
10:25:19 AM: ​​
10:25:19 AM: In file "/opt/build/repo/functions/index.js"
10:25:19 AM: Cannot find module 'firebase-functions'
10:25:19 AM: Require stack:
10:25:19 AM: - /opt/buildhome/.netlify-build-nvm/versions/node/v12.22.6/lib/node_modules/#netlify/build/node_modules/#netlify/zip-it-and-ship-it/src/node_dependencies/resolve.js
10:25:19 AM: - /opt/buildhome/.netlify-build-nvm/versions/node/v12.22.6/lib/node_modules/#netlify/build/node_modules/#netlify/zip-it-and-ship-it/src/node_dependencies/index.js
10:25:19 AM: - /opt/buildhome/.netlify-build-nvm/versions/node/v12.22.6/lib/node_modules/#netlify/build/node_modules/#netlify/zip-it-and-ship-it/src/main.js
10:25:19 AM: - /opt/buildhome/.netlify-build-nvm/versions/node/v12.22.6/lib/node_modules/#netlify/build/src/plugins_core/functions/index.js
10:25:19 AM: - /opt/buildhome/.netlify-build-nvm/versions/node/v12.22.6/lib/node_modules/#netlify/build/src/commands/get.js
10:25:19 AM: - /opt/buildhome/.netlify-build-nvm/versions/node/v12.22.6/lib/node_modules/#netlify/build/src/core/main.js
10:25:19 AM: - /opt/buildhome/.netlify-build-nvm/versions/node/v12.22.6/lib/node_modules/#netlify/build/src/core/bin.js
10:25:19 AM: ​
10:25:19 AM: Resolved config
10:25:19 AM: build:
10:25:19 AM: command: CI= npm run build
10:25:19 AM: commandOrigin: ui
10:25:19 AM: publish: /opt/build/repo/build
10:25:19 AM: publishOrigin: ui
10:25:19 AM: functionsDirectory: /opt/build/repo/functions
10:25:20 AM: Caching artifacts
10:25:20 AM: Started saving node modules
10:25:20 AM: Finished saving node modules
10:25:20 AM: Started saving build plugins
10:25:20 AM: Finished saving build plugins
10:25:20 AM: Started saving pip cache
10:25:20 AM: Finished saving pip cache
10:25:20 AM: Started saving emacs cask dependencies
10:25:20 AM: Finished saving emacs cask dependencies
10:25:20 AM: Started saving maven dependencies
10:25:20 AM: Finished saving maven dependencies
10:25:20 AM: Started saving boot dependencies
10:25:20 AM: Finished saving boot dependencies
10:25:20 AM: Started saving rust rustup cache
10:25:20 AM: Finished saving rust rustup cache
10:25:20 AM: Started saving go dependencies
10:25:20 AM: Finished saving go dependencies
10:25:23 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:25:23 AM: Creating deploy upload records
10:25:23 AM: Failing build: Failed to build site
10:25:23 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2
10:25:23 AM: Finished processing build request in 2m12.906017596s`
You need to clear the functions directory from the Netlify App.
To do so:
Go to Site settings.
On your left side scroll till you see functions and click
Then click Edit settings. In File directory delete functions
and the click save and retry to deploy.

Build script returned non-zero exit code: 1

im trying to deploy website on netlify but some problems occur. This is a log:
11:37:14 AM: Build ready to start
11:37:15 AM: build-image version: 9e0f207a27642d0115b1ca97cd5e8cebbe492f63
11:37:15 AM: build-image tag: v3.3.2
11:37:15 AM: buildbot version: ef8d0929ed0baabafd8bbb7d0b021e1fc24180c0
11:37:16 AM: Fetching cached dependencies
11:37:16 AM: Failed to fetch cache, continuing with build
11:37:16 AM: Starting to prepare the repo for build
11:37:16 AM: No cached dependencies found. Cloning fresh repo
11:37:16 AM: git clone https://github.com/ocebeki/transmess
11:37:18 AM: Preparing Git Reference refs/heads/master
11:37:19 AM: Starting build script
11:37:19 AM: Installing dependencies
11:37:20 AM: Downloading and installing node v10.16.0...
11:37:20 AM: Downloading https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-x64.tar.xz...
11:37:21 AM:
########################
11:37:21 AM: 34.2%
11:37:21 AM:
########################################################
11:37:21 AM: ################ 100.0%
11:37:21 AM: Computing checksum with sha256sum
11:37:21 AM: Checksums matched!
11:37:23 AM: Now using node v10.16.0 (npm v6.9.0)
11:37:23 AM: Attempting ruby version 2.6.2, read from environment
11:37:25 AM: Using ruby version 2.6.2
11:37:25 AM: Using PHP version 5.6
11:37:25 AM: Started restoring cached node modules
11:37:25 AM: Finished restoring cached node modules
11:37:25 AM: Installing NPM modules using NPM version 6.9.0
11:37:28 AM: npm
11:37:28 AM: ERR!
11:37:28 AM: failed during stage 'building site': Build script returned non-zero exit code: 1
11:37:28 AM: code EINVALIDTAGNAME
11:37:28 AM: npm
11:37:28 AM: ERR! Invalid tag name "^4.12.": Tags may not have any characters that encodeURIComponent encodes.
I tried build on the local env and then deploy on netlify but didn't work neither.
Can anyone help me ?
Fix the issue in the package.json for the invalid tag in one of your dependencies:
"node-sass": "^4.12.",
should be a valid form (missing):
"node-sass": "^4.12.0",

Error running command: Build script returned non-zero exit code: 1

Locally (using 'gatsby develop') it runs fine - but when I deploy to Netlify with 'gatsby build' I get this error:
########################################################################
6:15:57 AM: ⚠ mozjpeg pre-build test failed
6:15:57 AM: ℹ compiling from source
6:16:33 AM: ✔ mozjpeg built successfully
6:16:33 AM: > pngquant-bin#5.0.0 postinstall /opt/build/repo/node_modules/pngquant-bin
6:16:33 AM: > node lib/install.js
6:16:34 AM: ✔ pngquant pre-build test passed successfully
6:16:42 AM: npm
6:16:42 AM: WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4 (node_modules/fsevents):
6:16:42 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
6:16:42 AM: added 1945 packages from 1150 contributors and audited 27946 packages in 94.548s
6:16:42 AM: found 5 moderate severity vulnerabilities
6:16:42 AM: run `npm audit fix` to fix them, or `npm audit` for details
6:16:42 AM: NPM modules installed
6:16:42 AM: Started restoring cached go cache
6:16:42 AM: Finished restoring cached go cache
6:16:42 AM: unset GOOS;
6:16:42 AM: unset GOARCH;
6:16:42 AM: export GOROOT='/opt/buildhome/.gimme/versions/go1.10.linux.amd64';
6:16:42 AM: export PATH="/opt/buildhome/.gimme/versions/go1.10.linux.amd64/bin:${PATH}";
6:16:42 AM: go version >&2;
6:16:42 AM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.10.linux.amd64.env';
6:16:42 AM: go version go1.10 linux/amd64
6:16:42 AM: Installing missing commands
6:16:42 AM: Verify run directory
6:16:43 AM: Executing user command: gatsby build
6:16:45 AM: success open and validate gatsby-config — 0.017 s
6:16:45 AM: Your plugins must export known APIs from their gatsby-node.js.
6:16:45 AM: The following exports aren't APIs. Perhaps you made a typo or your plugin is outdated?
6:16:45 AM: See https://www.gatsbyjs.org/docs/node-apis/ for the list of Gatsby Node APIs
6:16:45 AM: - Your site's gatsby-node.js is exporting "modifyWebpackConfig" which was removed in Gatsby v2. Refer to the migration guide for more info on upgrading to "onCreateWebpackConfig":
6:16:45 AM: https://gatsby.app/update-webpack-config
6:16:45 AM: Caching artifacts
6:16:45 AM: Started saving node modules
6:16:45 AM: Finished saving node modules
6:16:45 AM: Started saving pip cache
6:16:45 AM: Finished saving pip cache
6:16:45 AM: Started saving emacs cask dependencies
6:16:45 AM: Finished saving emacs cask dependencies
6:16:45 AM: Started saving maven dependencies
6:16:45 AM: Finished saving maven dependencies
6:16:45 AM: Started saving boot dependencies
6:16:45 AM: Finished saving boot dependencies
6:16:45 AM: Started saving go dependencies
6:16:45 AM: Finished saving go dependencies
6:16:46 AM: Cached node version v8.12.0
6:16:46 AM: Error running command: Build script returned non-zero exit code: 1
6:16:46 AM: Failing build: Failed to build site
6:16:46 AM: failed during stage 'building site': Build script returned non-zero exit code: 1
6:16:46 AM: Finished processing build request in 1m47.357793899s
Have done all the standard things like reinstall node and npm (as I thought it may be an issue) but, after a few weeks, I am absolutely stumped as to what the issue is. Likewise, there isn't a huge amount of documentation online so fairly stuck as to where to even start with tackling this issue.
In your gatsby-node.js you will have an export similar to the one below. modifyWebpackConfig was removed and replaced with onCreateWebpackConfig in version 2 of Gatsby.
exports.modifyWebpackConfig = ({ config, stage }) => {
switch (stage) {
case `build-javascript`:
config.plugin(`Foo`, webpackFooPlugin, null)
break
}
return config
};
This has now been changed to:
exports.onCreateWebpackConfig = ({ stage, actions }) => {
switch (stage) {
case `build-javascript`:
actions.setWebpackConfig({
plugins: [webpackFooPlugin],
})
}
}
See docs here.

Resources