Deploy fails during stage ‘building site’

Hello everyone,

I am having issues with my deployment and am getting the following error:
9:40:38 PM: Started saving boot dependencies
9:40:38 PM: Finished saving boot dependencies
9:40:38 PM: Started saving go dependencies
9:40:38 PM: Finished saving go dependencies
9:40:42 PM: Error running command: Build script returned non-zero exit code: 1
9:40:42 PM: Failing build: Failed to build site
9:40:42 PM: failed during stage ‘building site’: Build script returned non-zero exit code: 1
9:40:42 PM: Finished processing build request in 1m41.271985143s
My Gatsby site work fine locally.
Here is the link to the code

Would appreaciate any help as I am really stuck:(

Hey @ghost-goblin, welcome :slight_smile: sorry to hear you’re running into this. We’ll need your Netlify url and a link to the failing deploy so we can dig in further. Can you also please share your build settings? You’ll want something like this:

Hi Jen,
Thanks for your reply.
You can find the link to my site here.

As for the build settings, I have managed to get it to work by changing "gatsby buld to "“build” …

I’m wondering if this is right because the site loads blank on my other devices.
Would appreciate your input.

Thanks

hi there, can you post your package.json please? The command you are mentioning in the UI needs to match what is defined in the package.json needs to match the tooling you are trying to run.

{

  "name": "gatsby-personal-starter-blog",

  "private": true,

  "description": "A personal computing blog written and developed by Chloe Urisohn",

  "version": "1.0.0",

  "author": "Thomas Wang <thomas@wang.sh>",

  "bugs": {

    "url": "https://github.com/gatsbyjs/gatsby/issues"

  },

  "dependencies": {

    "@mdx-js/mdx": "^1.5.1",

    "@mdx-js/react": "^1.5.1",

    "babel-plugin-styled-components": "^1.10.0",

    "gatsby": "^2.21.11",

    "gatsby-image": "^2.0.39",

    "gatsby-plugin-feed-mdx": "^1.0.0",

    "gatsby-plugin-google-analytics": "^2.0.18",

    "gatsby-plugin-manifest": "^2.0.29",

    "gatsby-plugin-mdx": "^1.0.52",

    "gatsby-plugin-netlify-cms": "^4.0.0",

    "gatsby-plugin-offline": "^2.0.25",

    "gatsby-plugin-react-helmet": "^3.0.12",

    "gatsby-plugin-sharp": "^2.0.35",

    "gatsby-plugin-styled-components": "^3.0.7",

    "gatsby-plugin-typography": "^2.2.13",

    "gatsby-remark-copy-linked-files": "^2.0.11",

    "gatsby-remark-images": "^2.0.6",

    "gatsby-remark-responsive-iframe": "^2.1.1",

    "gatsby-remark-smartypants": "^2.0.9",

    "gatsby-remark-vscode": "^1.0.4",

    "gatsby-source-filesystem": "^2.0.29",

    "gatsby-transformer-sharp": "^2.1.18",

    "netlify-cms-app": "^2.9.1",

    "react": "^16.8.6",

    "react-dom": "^16.8.6",

    "react-helmet": "^5.2.0",

    "react-switch": "^5.0.0",

    "react-typography": "^0.16.19",

    "styled-components": "^4.2.0",

    "typeface-merriweather": "0.0.72",

    "typeface-montserrat": "0.0.54",

    "typography": "^0.16.19",

    "typography-theme-wordpress-2016": "^0.16.19"

  },

  "devDependencies": {

    "prettier": "^1.17.0"

  },

  "homepage": "https://github.com/gatsbyjs/gatsby-starter-blog#readme",

  "keywords": [

    "gatsby"

  ],

  "license": "MIT",

  "main": "n/a",

  "repository": {

    "type": "git",

    "url": "git+https://github.com/gatsbyjs/gatsby-starter-blog.git"

  },

  "scripts": {

    "build": "gatsby build",

    "develop": "gatsby develop",

    "format": "prettier --write src/**/*.{js,jsx}",

    "start": "npm run develop",

    "serve": "gatsby serve",

    "test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\""

  }

}

thanks for that! it all looks correct, actually. And when i pulled your site, i can see this:

what are you seeing?

Sorry, this is the link to the site,
I’m trying to re-create the problem and it seems I get an error if I use sass or typography plugins.

The site either doesn’t load or I get an exit code: 1.

The site works fine locally.

UPDATE
When I removed the “plugins: [gatsby-plugin-sass]” from gatsbyconfig.js, the site seemed to have deployed fine.

can you link us to one of those failed deploys so we can read through the error log, please?

i’m going to guess the problem is one of your dependencies not playing well with another one, or, it is this problem:

Here is one of the error logs.

I think the main issue is here:

11:20:28 PM: Tried looking for an installed package in the following paths:
11:20:28 PM:  - /opt/build/repo/node_modules/gatsby/dist/bootstrap/load-themes/node_modules/gatsby-plugin-sass
11:20:28 PM:  - /opt/build/repo/node_modules/gatsby/dist/bootstrap/node_modules/gatsby-plugin-sass
11:20:28 PM:  - /opt/build/repo/node_modules/gatsby/dist/node_modules/gatsby-plugin-sass
11:20:28 PM:  - /opt/build/repo/node_modules/gatsby/node_modules/gatsby-plugin-sass
11:20:28 PM:  - /opt/build/repo/node_modules/gatsby-plugin-sass
11:20:28 PM:  - /opt/build/node_modules/gatsby-plugin-sass
11:20:28 PM:  - /opt/node_modules/gatsby-plugin-sass
11:20:28 PM:  - /node_modules/gatsby-plugin-sass
11:20:28 PM: not finished open and validate gatsby-configs - 0.028s

How can I fix this issue?

2:03:10 PM: Executing user command: gatsby build

2:03:13 PM: error Couldn't find the "gatsby-plugin-sass" plugin declared in "/opt/build/repo/gatsby-config.js".

2:03:13 PM: Tried looking for a local plugin in /opt/build/repo/plugins/gatsby-plugin-sass.

2:03:13 PM: Tried looking for an installed package in the following paths:

2:03:13 PM: - /opt/build/repo/node_modules/gatsby/dist/bootstrap/load-themes/node_modules/gatsby-plugin-sass

2:03:13 PM: - /opt/build/repo/node_modules/gatsby/dist/bootstrap/node_modules/gatsby-plugin-sass

2:03:13 PM: - /opt/build/repo/node_modules/gatsby/dist/node_modules/gatsby-plugin-sass

2:03:13 PM: - /opt/build/repo/node_modules/gatsby/node_modules/gatsby-plugin-sass

2:03:13 PM: - /opt/build/repo/node_modules/gatsby-plugin-sass

2:03:13 PM: - /opt/build/node_modules/gatsby-plugin-sass

2:03:13 PM: - /opt/node_modules/gatsby-plugin-sass

2:03:13 PM: - /node_modules/gatsby-plugin-sass

2:03:13 PM: not finished open and validate gatsby-configs - 0.017s

Here is the plugin code in the gatsby-config.js file:

plugins: [

    {

      resolve: `gatsby-plugin-sass`,

      options: {

        pathToConfigModule:`${__dirname}/src/styles/index`,

        // Override the file regex for SASS

        sassRuleTest: /\.global\.s(a|c)ss$/,

        // Override the file regex for CSS modules

        sassRuleModulesTest: /\.mod\.s(a|c)ss$/,

      },

    },
]

Sounds like you’re up and running (:partying_face:) since removing that plugin from your Gatsby config, but the issue may have been (reading your package.json) that you hadn’t installed the plugin yet: npm install --save node-sass gatsby-plugin-sass

Please give a shout if we can help with anything else!