Closed MAU-Estate closed 1 year ago
Was able to get past this specific issue. Deleting package-lock.json in the root but leaving those files within the subdirectories being built seems to get us past this. Will open a new issue for new problems if they occur.
Summary
I am a new developer for a client whose Gatsby website hosted on Netlify has not been building or deploying automatically for over a year. Cloning the repo locally, installing node modules, and using the Netlify CLI to netlify deploy --prod builds and works perfectly to deploy changes to the site manually but automatic deploys all fail.
The repo is private on Github but our Netlify instance is set to deploy automatically from either changes in the repo or with a deploy hook from the Sanity CMS. Both of those fail.
The last successful automatic deploy from the Sanity hook was September 21, 2021 and the last successful deploy from Github was March 7, 2022.
The root folder package-lock.json file is the following:
The web folder package-lock.json file is the following:
The complete failed deploy log is the following:
The things I’ve tried so far are: (1) Verify that the build image is up to date - Ubuntu Focal 20.04 (default) (2) Setting up a simplified version of the site using the same versions of Gatsby 3 and Node 12 to determine if either of those might be the issue. (They are not) (3) Deleting package-lock.json files to see if the node modules were incompatible. This approach at least got me past the Initialization phase and into the build phase. New build fail log is the following:
gatsby-config.js file is the following:
Any help or suggestions would be so greatly appreciated. Thanks for reading!
Steps to reproduce
A link to a reproduction repository
https://github.com/MAU-Estate/public-testing-repo
Plugin version
@netlify/plugin-gatsby@3.6.2
More information about your build
netlify.toml
)What OS are you using?
None
Your netlify.toml file
`netlify.toml`
```toml [build] functions = "functions" [[redirects]] from = "/api/*" to = "/.netlify/functions/:splat" status = 200 ```Configuration
`gatsby-config.js` and options
``` // Load variables from `.env` as soon as possible require('dotenv').config({ path: `.env.${process.env.NODE_ENV || 'development'}`, }) const clientConfig = require('./client-config') const isProd = process.env.NODE_ENV === 'production' module.exports = { flags: { FAST_DEV: true, DEV_SSR: false, }, plugins: [ 'gatsby-plugin-postcss', 'gatsby-plugin-react-helmet', { resolve: `gatsby-plugin-sharp`, options: { defaults: { formats: [`auto`, `webp`], placeholder: `blurred`, defaultQuality: 50, backgroundColor: `transparent`, }, }, }, `gatsby-transformer-sharp`, `gatsby-plugin-image`, { resolve: `gatsby-plugin-purgecss`, options: { printRejected: false, tailwind: true, }, }, { resolve: 'gatsby-plugin-svgr', options: { prettier: true, svgo: true, replaceAttrValues: { '#000000': 'currentColor', '#000': 'currentColor', }, }, }, `gatsby-plugin-modal-routing-3`, { resolve: 'gatsby-plugin-sanity-image', options: { ...clientConfig.sanity, customImageTypes: ['SanityPreviewImage', 'SanityFigure', 'SanitySlide'], defaultImageConfig: { quality: 35, maxWidth: 1000, fit: 'clip', auto: 'format', }, }, }, { resolve: 'gatsby-source-sanity', options: { ...clientConfig.sanity, token: process.env.SANITY_READ_TOKEN, watchMode: !isProd, overlayDrafts: !isProd, }, }, { resolve: `gatsby-plugin-manifest`, options: { name: `maryannunger.com`, short_name: `maryannunger`, description: 'Website for the estate of Mary Ann Unger.', start_url: `/`, background_color: `#1f1f1f`, theme_color: `#1f1f1f`, display: `minimal-ui`, icon: 'src/assets/images/favicon.png', }, }, { resolve: `gatsby-plugin-netlify`, }, ], } ```Environment
Environment
``` # Paste output from `npx envinfo` here. ```Gatsby info
gatsby info
``` # Paste output from `gatsby info` here. ```Your _redirects file
`_redirects`
```toml /free-standing /work /wall-mounted /work /small-bronzes /work /public-art /work /works-on-paper /work /bio /#intro /obituary /#intro https://maue.netlify.app/* https://www.maryannunger.com/:splat 301! https://www.maryannungerestate.com/* https://www.maryannunger.com/:splat 301! https://maryannungerestate.com/* https://www.maryannunger.com/:splat 301! ```Builds logs (or link to your logs)
Build logs
``` > 12:12:14 PM: Netlify Build 12:12:14 PM: ──────────────────────────────────────────────────────────────── 12:12:14 PM: 12:12:14 PM: ❯ Version 12:12:14 PM: @netlify/build 29.11.5 12:12:14 PM: 12:12:14 PM: ❯ Flags 12:12:14 PM: baseRelDir: true 12:12:14 PM: buildId: 646b9417db543e0008b6650a 12:12:14 PM: deployId: 646b9417db543e0008b6650c 12:12:14 PM: 12:12:14 PM: ❯ Current directory 12:12:14 PM: /opt/build/repo 12:12:14 PM: 12:12:14 PM: ❯ Config file 12:12:14 PM: /opt/build/repo/netlify.toml 12:12:14 PM: 12:12:14 PM: ❯ Context 12:12:14 PM: branch-deploy 12:12:15 PM: 12:12:15 PM: ❯ Installing plugins 12:12:15 PM: - @netlify/plugin-gatsby@3.6.2 12:12:29 PM: 12:12:29 PM: ❯ Loading plugins 12:12:29 PM: - @netlify/plugin-gatsby@3.6.2 from Netlify app 12:12:33 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2) 12:12:31 PM: @netlify/plugin-gatsby (onPreBuild event) 12:12:31 PM: ──────────────────────────────────────────────────────────────── 12:12:31 PM: 12:12:31 PM: No Gatsby cache found. Building fresh. 12:12:31 PM: Please install `gatsby-plugin-netlify` and enable it in your gatsby-config.js. https://www.gatsbyjs.com/plugins/gatsby-plugin-netlify/ 12:12:31 PM: 12:12:31 PM: (@netlify/plugin-gatsby onPreBuild completed in 8ms) 12:12:31 PM: 12:12:31 PM: Build command from Netlify app 12:12:31 PM: ──────────────────────────────────────────────────────────────── 12:12:31 PM: 12:12:31 PM: $ npm run build-web 12:12:31 PM: npm ERR! missing script: build-web 12:12:31 PM: npm ERR! 12:12:31 PM: npm ERR! Did you mean this? 12:12:31 PM: npm ERR! build 12:12:31 PM: npm ERR! A complete log of this run can be found in: 12:12:31 PM: npm ERR! /opt/buildhome/.npm/_logs/2023-05-22T16_12_31_176Z-debug.log 12:12:31 PM: 12:12:31 PM: "build.command" failed 12:12:31 PM: ──────────────────────────────────────────────────────────────── 12:12:31 PM: 12:12:31 PM: Error message 12:12:31 PM: Command failed with exit code 1: npm run build-web (https://ntl.fyi/exit-code-1) 12:12:31 PM: 12:12:31 PM: Error location 12:12:31 PM: In Build command from Netlify app: 12:12:31 PM: npm run build-web 12:12:31 PM: 12:12:31 PM: Resolved config 12:12:31 PM: build: 12:12:31 PM: base: /opt/build/repo 12:12:31 PM: command: npm run build-web 12:12:31 PM: commandOrigin: ui 12:12:31 PM: environment: 12:12:31 PM: - MAILCHIMP_API_KEY 12:12:31 PM: - SANITY_DEPLOY_STUDIO_TOKEN 12:12:31 PM: publish: /opt/build/repo/web/public 12:12:31 PM: publishOrigin: ui 12:12:31 PM: functionsDirectory: /opt/build/repo/web/functions 12:12:31 PM: plugins: 12:12:31 PM: - inputs: {} 12:12:31 PM: origin: ui 12:12:31 PM: package: '@netlify/plugin-gatsby' 12:12:33 PM: Build failed due to a user error: Build script returned non-zero exit code: 2 12:12:33 PM: Failing build: Failed to build site 12:12:33 PM: Finished processing build request in 1m5.078s ```Function logs
Function logs
``` # Paste logs here ```