Netlify Deployment "Failed During Stage 'Building Site': Build Script Returned Non-Zero Exit Code: 42"

netlify deployment: Failed during stage 'building site': Build script returned non-zero exit code: 2

I found the same error when trying to deploy my single-page React JS web applications to Netlify.

Following is the procedure I followed to solve the issue and successfully deploy the site.

  1. Go to Site Settings.

    Site Settings

  2. Select Build & Deploy dropdown from the menu.

  3. Select Continuous Deployment tab from the dropdown.

  4. Under the section Build Settings, Select Edit settings.

    • Change the build command as
      CI= npm run build
    • Click Save.

    Build Settings

  5. Then select Environment tab from the dropdown.

    • Select Edit variables.
    • As the Key enter CI and, as the value enter false.
    • Click Save.

    Environment Settings

  6. Finally retrying the deploying the site again.

This will help you to solve the issue related to hosting 'Rect JS' Applications in Netlify & your application will be deployed successfully.

Netlify deployment failed during stage 'building site': Build script returned non-zero exit code: 42

The error you're seeing should just be a warning and shouldn't impact deployment. I'd double-check the netlify logs again and see if there's another error you can find.

The latest published version of jekyll-sass-converter still uses the sass gem. It looks like they haven't released a new version that uses sassc yet.

If you add the below to your Gemfile, and then run bundle install, Jekyll will pick up the version that uses sassc instead of sass and get you past the warning you see

gem 'jekyll-sass-converter', git: 'https://github.com/jekyll/jekyll-sass-converter', branch: 'master'

If that doesn't work, try and build your site locally first and see if you get any errors

Build script returned non-zero exit code: 2 - React

You need to specify base directory either in netlify settings.
Go to Settings -> Build and Deploy -> Edit Settings and fill it with client.

Or you can create netlify.toml in project dir with following config

[build]
# Directory to change to before starting a build.
# This is where we will look for package.json/.nvmrc/etc.
# If not set, defaults to the root directory.
base = "client"


Related Topics



Leave a reply



Submit