Getting "Failed during stage 'building site': Build script returned non-zero exit code: 1" - works with netlify dev locally

Starting today, I can’t build my website ( anymore - not sure what happened. This is the log I get:
6:50:26 PM: No npm workspaces detected
6:50:26 PM: Started restoring cached node modules
6:50:26 PM: Finished restoring cached node modules
6:50:26 PM: Installing NPM modules using NPM version 6.14.4
6:50:27 PM: npm ERR! Cannot read property ‘match’ of undefined
6:50:27 PM: npm ERR! A complete log of this run can be found in:
6:50:27 PM: npm ERR! /opt/buildhome/.npm/_logs/2022-04-05T16_50_27_369Z-debug.log
6:50:27 PM: Creating deploy upload records
6:50:27 PM: Error during NPM install
6:50:27 PM: Build was terminated: Build script returned non-zero exit code: 1
6:50:27 PM: Failing build: Failed to build site
6:50:27 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 1 (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
6:50:27 PM: Finished processing build request in 25.220495302s

I don’t know what’s happening nor what I am supposed to do :man_shrugging:t2:

Hey there, @antonsten :wave:

Thanks for reaching out! Can you elaborate on when this issue started? We experienced a brief error in CDN service when you wrote in (more details here) so my first thought is that this could be related.

If it is not resolved now that the CDN error has fixed, this Support Guide contains a ton of useful debugging tips that can likely help you solve your problem :slight_smile: Additionally, this Support Guide houses all of our resources for debugging build and deploy issues.

We also recommend trying to search the forums with the build error you encountered - it’s likely your question was already asked by someone else!

If you are still having problems, please provide as much information as you can on what you have already tried, what your build settings are, your package.json, etc. Thanks!

Hey! I just experienced it today but my previous build was March 20 so could have been anytime in between really? I am still getting the same error so I don’t think it’s related to the CDN issues?

This is my package.json (nothing changed) since last successful build:
“name”: “”,
“private”: true,
“description”: “Gatsby theme for”,
“version”: “0.1.0”,
“author”: “Alexander Hansson”,
“dependencies”: {
“gatsby”: “^2.25.3”,
“gatsby-cli”: “^2.12.24”,
“gatsby-image”: “^2.0.37”,
“gatsby-plugin-feed”: “^2.2.1”,
“gatsby-plugin-google-analytics”: “^2.0.18”,
“gatsby-plugin-manifest”: “^2.0.28”,
“gatsby-plugin-offline”: “^2.0.25”,
“gatsby-plugin-postcss”: “^2.0.7”,
“gatsby-plugin-purgecss”: “^3.1.1”,
“gatsby-plugin-react-helmet”: “^3.0.12”,
“gatsby-plugin-sharp”: “^2”,
“gatsby-plugin-sitemap”: “^2.1.0”,
“gatsby-plugin-slug”: “^1.0.1”,
“gatsby-plugin-stripe”: “^1.2.0”,
“gatsby-plugin-typography”: “^2.2.12”,
“gatsby-remark-copy-linked-files”: “^2.0.11”,
“gatsby-remark-external-links”: “^0.0.4”,
“gatsby-remark-images”: “^2.0.6”,
“gatsby-remark-prismjs”: “^3.2.8”,
“gatsby-remark-responsive-iframe”: “^2.1.1”,
“gatsby-remark-smartypants”: “^2.0.9”,
“gatsby-remark-social-cards”: “^0.4.1”,
“gatsby-source-filesystem”: “^2.0.29”,
“gatsby-transformer-remark”: “^2.3.8”,
“gatsby-transformer-sharp”: “^2”,
“git”: “^0.1.5”,
“netlify-cli”: “^2.71.0”,
“netlify-plugin-gatsby-cache”: “^0.2.1”,
“netlify-plugin-image-optim”: “^0.2.0”,
“prismjs”: “^1.16.0”,
“react”: “^16.3”,
“react-cookies”: “^0.1.1”,
“react-dom”: “^16.8.6”,
“react-helmet”: “^5.2.0”,
“react-rough-notation”: “^0.1.1”,
“react-typography”: “^0.16.19”,
“rough-notation”: “^0.4.0”,
“sharp”: “^0.25.2”,
“stripe”: “^7.0.1”,
“typeface-merriweather”: “0.0.72”,
“typeface-montserrat”: “0.0.54”,
“typography”: “^0.16.19”,
“typography-theme-wordpress-2016”: “^0.16.19”,
“yarn”: “^1.22.4”
“devDependencies”: {
@netlify/plugin-gatsby”: “^1.0.3”,
“netlify-plugin-checklinks”: “^3.0.1”,
“prettier”: “^1.16.4”,
“tailwindcss”: “^0.7.4”
“license”: “MIT”,
“scripts”: {
“build”: “gatsby build”,
“develop”: “gatsby develop”,
“format”: “prettier --write src/**/*.{js,jsx}”,
“start”: “npm run develop”


I can see that you have been able to build successfully yesterday. Have you been able to figure out the issue ?

Hope to hear from you!

1 Like