Build fails on Gatsby & Sanity site deploy with error for invalid lock file

Is anyone still having issues with this? I’m having trouble building without clearing my cache and redeploying.

I have ENV vars for NODE_VERSION, NPM_FLAGS and NPM_VERSION
They match my local version.

The first error is this with the full log below:

1:27:19 PM: npm ERR! code ERESOLVE
1:27:19 PM: npm ERR! ERESOLVE could not resolve
1:27:19 PM: npm ERR!
1:27:19 PM: npm ERR! While resolving: eslint-config-standard@16.0.3
1:27:19 PM: npm ERR! Found: eslint@8.8.0

Full Log:

1:26:49 PM: Build ready to start
1:26:51 PM: build-image version: 0e2f4c52031ab562db66aec633308326e3b108d0 (focal)
1:26:51 PM: build-image tag: focal
1:26:51 PM: buildbot version: 667117c26805e29113bede4ca1afe54070a4e3b1
1:26:51 PM: Fetching cached dependencies
1:26:51 PM: Starting to download cache of 578.4MB
1:26:55 PM: Finished downloading cache in 4.511307623s
1:26:55 PM: Starting to extract cache
1:26:58 PM: Finished extracting cache in 3.150731749s
1:26:58 PM: Finished fetching cache in 7.79885156s
1:26:58 PM: Starting to prepare the repo for build
1:26:59 PM: Preparing Git Reference refs/heads/main
1:27:01 PM: Parsing package.json dependencies
1:27:02 PM: Different build dir detected, going to use the one specified in the Netlify configuration file: '' versus '/' in the Netlify UI
1:27:02 PM: Starting build script
1:27:02 PM: Installing dependencies
1:27:02 PM: Python version set to 2.7
1:27:02 PM: Started restoring cached node version
1:27:04 PM: Finished restoring cached node version
1:27:04 PM: v14.18.1 is already installed.
1:27:05 PM: Now using node v14.18.1 (npm v8.13.2)
1:27:05 PM: Started restoring cached build plugins
1:27:05 PM: Finished restoring cached build plugins
1:27:05 PM: Attempting ruby version 2.7.2, read from environment
1:27:06 PM: Using ruby version 2.7.2
1:27:06 PM: Using PHP version 8.0
1:27:07 PM: No npm workspaces detected
1:27:07 PM: Started restoring cached node modules
1:27:07 PM: Finished restoring cached node modules
1:27:07 PM: Started restoring cached go cache
1:27:07 PM: Finished restoring cached go cache
1:27:07 PM: Installing Go version 1.17 (requested 1.17)
1:27:13 PM: unset GOOS;
1:27:13 PM: unset GOARCH;
1:27:13 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.17.linux.amd64';
1:27:13 PM: export PATH="/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}";
1:27:13 PM: go version >&2;
1:27:13 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.17.linux.amd64.env"
1:27:13 PM: go version go1.17 linux/amd64
1:27:13 PM: Installing missing commands
1:27:13 PM: Verify run directory
1:27:15 PM: ​
1:27:15 PM: ────────────────────────────────────────────────────────────────
1:27:15 PM:   Netlify Build                                                 
1:27:15 PM: ────────────────────────────────────────────────────────────────
1:27:15 PM: ​
1:27:15 PM: ❯ Version
1:27:15 PM:   @netlify/build 27.4.2
1:27:15 PM: ​
1:27:15 PM: ❯ Flags
1:27:15 PM:   baseRelDir: true
1:27:15 PM:   buildId: 62d98c5963a49c13eadee8fb
1:27:15 PM:   deployId: 62d98c5963a49c13eadee8fd
1:27:15 PM: ​
1:27:15 PM: ❯ Current directory
1:27:15 PM:   /opt/build/repo
1:27:15 PM: ​
1:27:15 PM: ❯ Config file
1:27:15 PM:   No config file was defined: using default values.
1:27:15 PM: ​
1:27:15 PM: ❯ Context
1:27:15 PM:   production
1:27:15 PM: ​
1:27:15 PM: ────────────────────────────────────────────────────────────────
1:27:15 PM:   1. Build command from Netlify app                             
1:27:15 PM: ────────────────────────────────────────────────────────────────
1:27:15 PM: ​
1:27:15 PM: $ npm run build-web
1:27:15 PM: > ainc-gatsby-sanity@0.0.0 build-web
1:27:15 PM: > lerna bootstrap && (cd studio && SANITY_AUTH_TOKEN=$SANITY_DEPLOY_STUDIO_TOKEN npm run graphql-deploy) && (cd web && npm run build)
1:27:15 PM: lerna notice cli v4.0.0
1:27:15 PM: lerna info ci enabled
1:27:16 PM: lerna info Bootstrapping 2 packages
1:27:16 PM: lerna info Installing external dependencies
1:27:19 PM: lerna ERR! npm ci exited 1 in 'ainc-gatsby-sanity-studio'
1:27:19 PM: lerna ERR! npm ci stderr:
1:27:19 PM: npm WARN ERESOLVE overriding peer dependency
1:27:19 PM: npm WARN While resolving: @hot-loader/react-dom@16.14.0+4.13.0
1:27:19 PM: npm WARN Found: react@17.0.2
1:27:19 PM: npm WARN node_modules/react
1:27:19 PM: npm WARN   react@"^17.0.2" from the root project
1:27:19 PM: npm WARN   41 more (@reach/auto-id, @reach/utils, @sanity/base, ...)
1:27:19 PM: npm WARN
1:27:19 PM: npm WARN Could not resolve dependency:
1:27:19 PM: npm WARN peer react@"^16.14.0" from @hot-loader/react-dom@16.14.0+4.13.0
1:27:19 PM: npm WARN node_modules/@hot-loader/react-dom
1:27:19 PM: npm WARN   @hot-loader/react-dom@"^16.9.0-4.12.11" from @sanity/server@2.25.0
1:27:19 PM: npm WARN   node_modules/@sanity/server
1:27:19 PM: npm WARN
1:27:19 PM: npm WARN Conflicting peer dependency: react@16.14.0
1:27:19 PM: npm WARN node_modules/react
1:27:19 PM: npm WARN   peer react@"^16.14.0" from @hot-loader/react-dom@16.14.0+4.13.0
1:27:19 PM: npm WARN   node_modules/@hot-loader/react-dom
1:27:19 PM: npm WARN     @hot-loader/react-dom@"^16.9.0-4.12.11" from @sanity/server@2.25.0
1:27:19 PM: npm WARN     node_modules/@sanity/server
1:27:19 PM: npm WARN ERESOLVE overriding peer dependency
1:27:19 PM: npm WARN While resolving: @typescript-eslint/parser@1.13.0
1:27:19 PM: npm WARN Found: eslint@8.8.0
1:27:19 PM: npm WARN node_modules/eslint
1:27:19 PM: npm WARN   dev eslint@"^8.3.0" from the root project
1:27:19 PM: npm WARN   9 more (@typescript-eslint/experimental-utils, babel-eslint, ...)
1:27:19 PM: npm WARN
1:27:19 PM: npm WARN Could not resolve dependency:
1:27:19 PM: npm WARN peer eslint@"^5.0.0" from @typescript-eslint/parser@1.13.0
1:27:19 PM: npm WARN node_modules/@typescript-eslint/parser
1:27:19 PM: npm WARN   @typescript-eslint/parser@"^1.10.2" from prettier-eslint@9.0.2
1:27:19 PM: npm WARN   node_modules/prettier-eslint
1:27:19 PM: npm WARN
1:27:19 PM: npm WARN Conflicting peer dependency: eslint@5.16.0
1:27:19 PM: npm WARN node_modules/eslint
1:27:19 PM: npm WARN   peer eslint@"^5.0.0" from @typescript-eslint/parser@1.13.0
1:27:19 PM: npm WARN   node_modules/@typescript-eslint/parser
1:27:19 PM: npm WARN     @typescript-eslint/parser@"^1.10.2" from prettier-eslint@9.0.2
1:27:19 PM: npm WARN     node_modules/prettier-eslint
1:27:19 PM: npm ERR! code ERESOLVE
1:27:19 PM: npm ERR! ERESOLVE could not resolve
1:27:19 PM: npm ERR!
1:27:19 PM: npm ERR! While resolving: eslint-config-standard@16.0.3
1:27:19 PM: npm ERR! Found: eslint@8.8.0
1:27:19 PM: npm ERR! node_modules/eslint
1:27:19 PM: npm ERR!   dev eslint@"^8.3.0" from the root project
1:27:19 PM: npm ERR!   peer eslint@"*" from @typescript-eslint/experimental-utils@1.13.0
1:27:19 PM: npm ERR!   node_modules/@typescript-eslint/experimental-utils
1:27:19 PM: npm ERR!     @typescript-eslint/experimental-utils@"1.13.0" from @typescript-eslint/parser@1.13.0
1:27:19 PM: npm ERR!     node_modules/@typescript-eslint/parser
1:27:19 PM: npm ERR!       @typescript-eslint/parser@"^1.10.2" from prettier-eslint@9.0.2
1:27:19 PM: npm ERR!       node_modules/prettier-eslint
1:27:19 PM: npm ERR!         prettier-eslint@"^9.0.0" from prettier-eslint-cli@5.0.1
1:27:19 PM: npm ERR!         node_modules/prettier-eslint-cli
1:27:19 PM: npm ERR!   8 more (babel-eslint, eslint-plugin-es, eslint-plugin-import, ...)
1:27:19 PM: npm ERR!
1:27:19 PM: npm ERR! Could not resolve dependency:
1:27:19 PM: npm ERR! peer eslint@"^7.12.1" from eslint-config-standard@16.0.3
1:27:19 PM: npm ERR! node_modules/eslint-config-standard
1:27:19 PM: npm ERR!   dev eslint-config-standard@"^16.0.3" from the root project
1:27:19 PM: npm ERR!
1:27:19 PM: npm ERR! Conflicting peer dependency: eslint@7.32.0
1:27:19 PM: npm ERR! node_modules/eslint
1:27:19 PM: npm ERR!   peer eslint@"^7.12.1" from eslint-config-standard@16.0.3
1:27:19 PM: npm ERR!   node_modules/eslint-config-standard
1:27:19 PM: npm ERR!     dev eslint-config-standard@"^16.0.3" from the root project
1:27:19 PM: npm ERR!
1:27:19 PM: npm ERR! Fix the upstream dependency conflict, or retry
1:27:19 PM: npm ERR! this command with --force, or --legacy-peer-deps
1:27:19 PM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
1:27:19 PM: npm ERR!
1:27:19 PM: npm ERR! See /opt/buildhome/.npm/eresolve-report.txt for a full report.
1:27:19 PM: npm ERR! A complete log of this run can be found in:
1:27:19 PM: npm ERR!     /opt/buildhome/.npm/_logs/2022-07-21T17_27_16_860Z-debug-0.log
1:27:19 PM: lerna ERR! npm ci exited 1 in 'ainc-gatsby-sanity-studio'
1:27:19 PM: lerna WARN complete Waiting for 1 child process to exit. CTRL-C to exit immediately.
1:27:19 PM: ​
1:27:19 PM: ────────────────────────────────────────────────────────────────
1:27:19 PM:   "build.command" failed                                        
1:27:19 PM: ────────────────────────────────────────────────────────────────
1:27:19 PM: ​
1:27:19 PM:   Error message
1:27:19 PM:   Command failed with exit code 1: npm run build-web (https://ntl.fyi/exit-code-1)
1:27:19 PM: ​
1:27:19 PM:   Error location
1:27:19 PM:   In Build command from Netlify app:
1:27:19 PM:   npm run build-web
1:27:19 PM: ​
1:27:19 PM:   Resolved config
1:27:19 PM:   build:
1:27:19 PM:     base: /opt/build/repo
1:27:19 PM:     command: npm run build-web
1:27:19 PM:     commandOrigin: ui
1:27:19 PM:     environment:
1:27:19 PM:       - NODE_VERSION
1:27:19 PM:       - NPM_FLAGS
1:27:19 PM:       - NPM_VERSION
1:27:19 PM:       - SANITY_DEPLOY_STUDIO_TOKEN
1:27:19 PM:     publish: /opt/build/repo/web/public
1:27:19 PM:     publishOrigin: ui
1:27:19 PM: Caching artifacts
1:27:19 PM: Started saving node modules
1:27:19 PM: Finished saving node modules
1:27:19 PM: Started saving build plugins
1:27:19 PM: Finished saving build plugins
1:27:19 PM: Started saving pip cache
1:27:19 PM: Finished saving pip cache
1:27:19 PM: Started saving emacs cask dependencies
1:27:19 PM: Finished saving emacs cask dependencies
1:27:19 PM: Started saving maven dependencies
1:27:19 PM: Finished saving maven dependencies
1:27:19 PM: Started saving boot dependencies
1:27:19 PM: Finished saving boot dependencies
1:27:19 PM: Started saving rust rustup cache
1:27:19 PM: Finished saving rust rustup cache
1:27:19 PM: Started saving go dependencies
1:27:19 PM: Finished saving go dependencies
1:27:19 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
1:27:20 PM: Creating deploy upload records
1:27:20 PM: Failing build: Failed to build site
1:27:20 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
1:27:20 PM: Finished processing build request in 29.336337105s