Sanity Portfolio Starter build fails without clearing cache

I’m trying to deploy the Sanity Gatsby Starter Portfolio. I keep getting this error: npm ERR! ERESOLVE could not resolve which is something to do with package versions. I have added the following env variables (Node version, node flag for legacy peer deps and npm version.

I’ve been searching around trying to find this solution, but haven’t found something that works for me. So any advice would be great! I tried this suggestion with no success.

One other note: If I clear my cache and rebuild, the site builds fine. Once I trigger a new deploy from there is when the error occurs.

Site name: https://ainc-gatsby-sanity.netlify.app/

Build Settings

Full log

4:35:20 PM: Build ready to start
4:35:29 PM: build-image version: 0e2f4c52031ab562db66aec633308326e3b108d0 (focal)
4:35:29 PM: build-image tag: focal
4:35:29 PM: buildbot version: 667117c26805e29113bede4ca1afe54070a4e3b1
4:35:29 PM: Fetching cached dependencies
4:35:29 PM: Starting to download cache of 578.4MB
4:35:34 PM: Finished downloading cache in 4.170490317s
4:35:34 PM: Starting to extract cache
4:35:36 PM: Finished extracting cache in 2.001185571s
4:35:36 PM: Finished fetching cache in 6.260466737s
4:35:36 PM: Starting to prepare the repo for build
4:35:36 PM: Preparing Git Reference refs/heads/main
4:35:38 PM: Parsing package.json dependencies
4:35:38 PM: ​❯ Initial build environmentbaseRelDir: truebranch: maincontext: productioncwd: /opt/build/repofeatureFlags: []mode: buildbotrepositoryRoot: /opt/build/repositeId: 395eac55-3897-41ec-be29-b7b9c741fbd0​❯ UI build settingsbaseRelDir: truebuild:  base: /  command: npm run build-web  environment:    - NETLIFY_BUILD_DEBUG    - NODE_VERSION    - NPM_FLAGS    - NPM_VERSION    - SANITY_DEPLOY_STUDIO_TOKEN  publish: web/public​❯ Resolved build environmentbranch: mainbuildDir: /opt/build/repocontext: productionenv: []​❯ Resolved configbuild:  base: /opt/build/repo  command: npm run build-web  commandOrigin: ui  environment:    - NETLIFY_BUILD_DEBUG    - NODE_VERSION    - NPM_FLAGS    - NPM_VERSION    - SANITY_DEPLOY_STUDIO_TOKEN  publish: /opt/build/repo/web/public  publishOrigin: ui
4:35:38 PM: Different build dir detected, going to use the one specified in the Netlify configuration file: '' versus '/' in the Netlify UI
4:35:39 PM: Starting build script
4:35:39 PM: Installing dependencies
4:35:39 PM: Python version set to 2.7
4:35:39 PM: Started restoring cached node version
4:35:40 PM: Finished restoring cached node version
4:35:41 PM: v14.18.1 is already installed.
4:35:41 PM: Now using node v14.18.1 (npm v8.13.2)
4:35:41 PM: Started restoring cached build plugins
4:35:41 PM: Finished restoring cached build plugins
4:35:41 PM: Attempting ruby version 2.7.2, read from environment
4:35:42 PM: Using ruby version 2.7.2
4:35:43 PM: Using PHP version 8.0
4:35:43 PM: No npm workspaces detected
4:35:43 PM: Started restoring cached node modules
4:35:43 PM: Finished restoring cached node modules
4:35:43 PM: Started restoring cached go cache
4:35:43 PM: Finished restoring cached go cache
4:35:43 PM: Installing Go version 1.17 (requested 1.17)
4:35:48 PM: unset GOOS;
4:35:48 PM: unset GOARCH;
4:35:48 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.17.linux.amd64';
4:35:48 PM: export PATH="/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}";
4:35:48 PM: go version >&2;
4:35:48 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.17.linux.amd64.env"
4:35:48 PM: go version go1.17 linux/amd64
4:35:48 PM: Installing missing commands
4:35:48 PM: Verify run directory
4:35:50 PM: ​
4:35:50 PM: ────────────────────────────────────────────────────────────────
4:35:50 PM:   Netlify Build                                                 
4:35:50 PM: ────────────────────────────────────────────────────────────────
4:35:50 PM: ​
4:35:50 PM: ❯ Version
4:35:50 PM:   @netlify/build 27.4.2
4:35:50 PM: ​
4:35:50 PM: ❯ Flags
4:35:50 PM:   apiHost: api.netlify.com
4:35:50 PM:   baseRelDir: true
4:35:50 PM:   branch: main
4:35:50 PM:   buildId: 62d9b8888c278c16f038fbed
4:35:50 PM:   buildbotServerSocket: /tmp/netlify-buildbot-socket
4:35:50 PM:   cacheDir: /opt/build/cache
4:35:50 PM:   cachedConfigPath: /tmp/netlify_config.json
4:35:50 PM:   context: production
4:35:50 PM:   cwd: /opt/build/repo
4:35:50 PM:   deployId: 62d9b8888c278c16f038fbef
4:35:50 PM:   edgeFunctionsDistDir: /tmp/edge-62d9b8888c278c16f038fbef
4:35:50 PM:   featureFlags:
4:35:50 PM:     - edge_functions_cache_cli
4:35:50 PM:   framework: unknown
4:35:50 PM:   functionsDistDir: /tmp/zisi-62d9b8888c278c16f038fbef
4:35:50 PM:   mode: buildbot
4:35:50 PM:   nodePath: /opt/buildhome/.nvm/versions/node/v14.18.1/bin/node
4:35:50 PM:   repositoryRoot: /opt/build/repo
4:35:50 PM:   saveConfig: true
4:35:50 PM:   sendStatus: true
4:35:50 PM:   siteId: 395eac55-3897-41ec-be29-b7b9c741fbd0
4:35:50 PM:   statsd:
4:35:50 PM:     host: 10.65.155.70
4:35:50 PM:     port: 8125
4:35:50 PM:   testOpts:
4:35:50 PM:     silentLingeringProcesses: ''
4:35:50 PM: ​
4:35:50 PM: ❯ Current directory
4:35:50 PM:   /opt/build/repo
4:35:50 PM: ​
4:35:50 PM: ❯ Config file
4:35:50 PM:   No config file was defined: using default values.
4:35:50 PM: ​
4:35:50 PM: ❯ Resolved config
4:35:50 PM:   build:
4:35:50 PM:     base: /opt/build/repo
4:35:50 PM:     command: npm run build-web
4:35:50 PM:     commandOrigin: ui
4:35:50 PM:     environment:
4:35:50 PM:       - NETLIFY_BUILD_DEBUG
4:35:50 PM:       - NODE_VERSION
4:35:50 PM:       - NPM_FLAGS
4:35:50 PM:       - NPM_VERSION
4:35:50 PM:       - SANITY_DEPLOY_STUDIO_TOKEN
4:35:50 PM:     publish: /opt/build/repo/web/public
4:35:50 PM:     publishOrigin: ui
4:35:50 PM: ​
4:35:50 PM: ❯ Context
4:35:50 PM:   production
4:35:50 PM: ​
4:35:50 PM: ────────────────────────────────────────────────────────────────
4:35:50 PM:   1. Build command from Netlify app                             
4:35:50 PM: ────────────────────────────────────────────────────────────────
4:35:50 PM: ​
4:35:50 PM: $ npm run build-web
4:35:50 PM: > ainc-gatsby-sanity@0.0.0 build-web
4:35:50 PM: > lerna bootstrap && (cd studio && SANITY_AUTH_TOKEN=$SANITY_DEPLOY_STUDIO_TOKEN npm run graphql-deploy) && (cd web && npm run build)
4:35:50 PM: lerna notice cli v4.0.0
4:35:50 PM: lerna info ci enabled
4:35:51 PM: lerna info Bootstrapping 2 packages
4:35:51 PM: lerna info Installing external dependencies
4:35:53 PM: lerna ERR! npm ci exited 1 in 'ainc-gatsby-sanity-studio'
4:35:53 PM: lerna ERR! npm ci stderr:
4:35:53 PM: npm WARN ERESOLVE overriding peer dependency
4:35:53 PM: npm WARN While resolving: @hot-loader/react-dom@16.14.0+4.13.0
4:35:53 PM: npm WARN Found: react@17.0.2
4:35:53 PM: npm WARN node_modules/react
4:35:53 PM: npm WARN   react@"^17.0.2" from the root project
4:35:53 PM: npm WARN   41 more (@reach/auto-id, @reach/utils, @sanity/base, ...)
4:35:53 PM: npm WARN
4:35:53 PM: npm WARN Could not resolve dependency:
4:35:53 PM: npm WARN peer react@"^16.14.0" from @hot-loader/react-dom@16.14.0+4.13.0
4:35:53 PM: npm WARN node_modules/@hot-loader/react-dom
4:35:53 PM: npm WARN   @hot-loader/react-dom@"^16.9.0-4.12.11" from @sanity/server@2.25.0
4:35:53 PM: npm WARN   node_modules/@sanity/server
4:35:53 PM: npm WARN
4:35:53 PM: npm WARN Conflicting peer dependency: react@16.14.0
4:35:54 PM: Creating deploy upload records
4:35:53 PM: npm WARN node_modules/react
4:35:53 PM: npm WARN   peer react@"^16.14.0" from @hot-loader/react-dom@16.14.0+4.13.0
4:35:53 PM: npm WARN   node_modules/@hot-loader/react-dom
4:35:53 PM: npm WARN     @hot-loader/react-dom@"^16.9.0-4.12.11" from @sanity/server@2.25.0
4:35:53 PM: npm WARN     node_modules/@sanity/server
4:35:54 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
4:35:53 PM: npm WARN ERESOLVE overriding peer dependency
4:35:53 PM: npm WARN While resolving: @typescript-eslint/parser@1.13.0
4:35:53 PM: npm WARN Found: eslint@8.8.0
4:35:53 PM: npm WARN node_modules/eslint
4:35:53 PM: npm WARN   dev eslint@"^8.3.0" from the root project
4:35:53 PM: npm WARN   9 more (@typescript-eslint/experimental-utils, babel-eslint, ...)
4:35:53 PM: npm WARN
4:35:53 PM: npm WARN Could not resolve dependency:
4:35:53 PM: npm WARN peer eslint@"^5.0.0" from @typescript-eslint/parser@1.13.0
4:35:53 PM: npm WARN node_modules/@typescript-eslint/parser
4:35:53 PM: npm WARN   @typescript-eslint/parser@"^1.10.2" from prettier-eslint@9.0.2
4:35:53 PM: npm WARN   node_modules/prettier-eslint
4:35:53 PM: npm WARN
4:35:53 PM: npm WARN Conflicting peer dependency: eslint@5.16.0
4:35:53 PM: npm WARN node_modules/eslint
4:35:53 PM: npm WARN   peer eslint@"^5.0.0" from @typescript-eslint/parser@1.13.0
4:35:53 PM: npm WARN   node_modules/@typescript-eslint/parser
4:35:53 PM: npm WARN     @typescript-eslint/parser@"^1.10.2" from prettier-eslint@9.0.2
4:35:53 PM: npm WARN     node_modules/prettier-eslint
4:35:53 PM: npm ERR! code ERESOLVE
4:35:53 PM: npm ERR! ERESOLVE could not resolve
4:35:53 PM: npm ERR!
4:35:53 PM: npm ERR! While resolving: eslint-config-standard@16.0.3
4:35:53 PM: npm ERR! Found: eslint@8.8.0
4:35:53 PM: npm ERR! node_modules/eslint
4:35:53 PM: npm ERR!   dev eslint@"^8.3.0" from the root project
4:35:53 PM: npm ERR!   peer eslint@"*" from @typescript-eslint/experimental-utils@1.13.0
4:35:53 PM: npm ERR!   node_modules/@typescript-eslint/experimental-utils
4:35:53 PM: npm ERR!     @typescript-eslint/experimental-utils@"1.13.0" from @typescript-eslint/parser@1.13.0
4:35:53 PM: npm ERR!     node_modules/@typescript-eslint/parser
4:35:53 PM: npm ERR!       @typescript-eslint/parser@"^1.10.2" from prettier-eslint@9.0.2
4:35:53 PM: npm ERR!       node_modules/prettier-eslint
4:35:53 PM: npm ERR!         prettier-eslint@"^9.0.0" from prettier-eslint-cli@5.0.1
4:35:53 PM: npm ERR!         node_modules/prettier-eslint-cli
4:35:53 PM: npm ERR!   8 more (babel-eslint, eslint-plugin-es, eslint-plugin-import, ...)
4:35:53 PM: npm ERR!
4:35:53 PM: npm ERR! Could not resolve dependency:
4:35:53 PM: npm ERR! peer eslint@"^7.12.1" from eslint-config-standard@16.0.3
4:35:53 PM: npm ERR! node_modules/eslint-config-standard
4:35:53 PM: npm ERR!   dev eslint-config-standard@"^16.0.3" from the root project
4:35:53 PM: npm ERR!
4:35:53 PM: npm ERR! Conflicting peer dependency: eslint@7.32.0
4:35:53 PM: npm ERR! node_modules/eslint
4:35:53 PM: npm ERR!   peer eslint@"^7.12.1" from eslint-config-standard@16.0.3
4:35:53 PM: npm ERR!   node_modules/eslint-config-standard
4:35:53 PM: npm ERR!     dev eslint-config-standard@"^16.0.3" from the root project
4:35:53 PM: npm ERR!
4:35:53 PM: npm ERR! Fix the upstream dependency conflict, or retry
4:35:53 PM: npm ERR! this command with --force, or --legacy-peer-deps
4:35:53 PM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
4:35:53 PM: npm ERR!
4:35:53 PM: npm ERR! See /opt/buildhome/.npm/eresolve-report.txt for a full report.
4:35:53 PM: npm ERR! A complete log of this run can be found in:
4:35:53 PM: npm ERR!     /opt/buildhome/.npm/_logs/2022-07-21T20_35_51_526Z-debug-0.log
4:35:53 PM: lerna ERR! npm ci exited 1 in 'ainc-gatsby-sanity-studio'
4:35:53 PM: lerna WARN complete Waiting for 1 child process to exit. CTRL-C to exit immediately.
4:35:53 PM: ​
4:35:53 PM: ────────────────────────────────────────────────────────────────
4:35:53 PM:   "build.command" failed                                        
4:35:53 PM: ────────────────────────────────────────────────────────────────
4:35:53 PM: ​
4:35:53 PM:   Error message
4:35:53 PM:   Command failed with exit code 1: npm run build-web (https://ntl.fyi/exit-code-1)
4:35:53 PM: ​
4:35:53 PM:   Error location
4:35:53 PM:   In Build command from Netlify app:
4:35:53 PM:   npm run build-web
4:35:53 PM: ​
4:35:53 PM:   Resolved config
4:35:53 PM:   build:
4:35:53 PM:     base: /opt/build/repo
4:35:53 PM:     command: npm run build-web
4:35:53 PM:     commandOrigin: ui
4:35:53 PM:     environment:
4:35:53 PM:       - NETLIFY_BUILD_DEBUG
4:35:53 PM:       - NODE_VERSION
4:35:53 PM:       - NPM_FLAGS
4:35:53 PM:       - NPM_VERSION
4:35:53 PM:       - SANITY_DEPLOY_STUDIO_TOKEN
4:35:53 PM:     publish: /opt/build/repo/web/public
4:35:53 PM:     publishOrigin: ui
4:35:54 PM: Caching artifacts
4:35:54 PM: Started saving node modules
4:35:54 PM: Finished saving node modules
4:35:54 PM: Started saving build plugins
4:35:54 PM: Finished saving build plugins
4:35:54 PM: Started saving pip cache
4:35:54 PM: Finished saving pip cache
4:35:54 PM: Started saving emacs cask dependencies
4:35:54 PM: Finished saving emacs cask dependencies
4:35:54 PM: Started saving maven dependencies
4:35:54 PM: Finished saving maven dependencies
4:35:54 PM: Started saving boot dependencies
4:35:54 PM: Finished saving boot dependencies
4:35:54 PM: Started saving rust rustup cache
4:35:54 PM: Finished saving rust rustup cache
4:35:54 PM: Started saving go dependencies
4:35:54 PM: Finished saving go dependencies
4:35:54 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
4:35:54 PM: Failing build: Failed to build site
4:35:54 PM: Finished processing build request in 24.980235697s

Updated to include Debug mode build logs

Update, I have migrated to Yarn Workspaces and it seems to be working without clearing the cache. However, it does take a very long time (2+ min).

Any ideas on how to shorten that time or how to fix my previous issue with npm?

Have you checked:

Actually having the same issue. I think there are dependency issues with eslint in the studio build. Locally --force works, but for me, the NPM_FLAGS --force doesnt work.

Should also add the package-lock.json was outputted using --force if that makes any difference

3:51:56 PM: build-image version: d55944c047ef0aee2ac01971edde72cb2a50acfe (focal)
3:51:56 PM: build-image tag: v4.16.1
3:51:56 PM: buildbot version: a1ec8307ac4591dcd155485cdfce7d7be735ab26
3:51:56 PM: Fetching cached dependencies
3:51:56 PM: Starting to download cache of 116.9MB
3:51:57 PM: Finished downloading cache in 1.096860531s
3:51:57 PM: Starting to extract cache
3:51:58 PM: Finished extracting cache in 821.211106ms
3:51:58 PM: Finished fetching cache in 1.970702183s
3:51:58 PM: Starting to prepare the repo for build
3:51:58 PM: Preparing Git Reference refs/heads/main
3:52:00 PM: Parsing package.json dependencies
3:52:01 PM: Different build dir detected, going to use the one specified in the Netlify configuration file: '' versus '/' in the Netlify UI
3:52:01 PM: Starting build script
3:52:01 PM: Installing dependencies
3:52:01 PM: Python version set to 2.7
3:52:01 PM: Started restoring cached node version
3:52:02 PM: Finished restoring cached node version
3:52:02 PM: v18.12.1 is already installed.
3:52:02 PM: Now using node v18.12.1 (npm v8.19.2)
3:52:02 PM: Enabling node corepack
3:52:02 PM: Started restoring cached build plugins
3:52:02 PM: Finished restoring cached build plugins
3:52:02 PM: Attempting ruby version 2.7.2, read from environment
3:52:03 PM: Using ruby version 2.7.2
3:52:03 PM: Using PHP version 8.0
3:52:03 PM: No npm workspaces detected
3:52:03 PM: Started restoring cached node modules
3:52:03 PM: Finished restoring cached node modules
3:52:03 PM: Started restoring cached go cache
3:52:03 PM: Finished restoring cached go cache
3:52:05 PM: go version go1.19.4 linux/amd64
3:52:05 PM: Detected 0 framework(s)
3:52:05 PM: Installing missing commands
3:52:05 PM: Verify run directory
3:52:05 PM: Section completed: initializing
3:52:06 PM: ​
3:52:06 PM:   Netlify Build                                                 
3:52:06 PM: ────────────────────────────────────────────────────────────────
3:52:06 PM: ​
3:52:06 PM: ❯ Version
3:52:06 PM:   @netlify/build 29.4.0
3:52:06 PM: ​
3:52:06 PM: ❯ Flags
3:52:06 PM:   baseRelDir: true
3:52:06 PM:   buildId: 63b6819a7d93c43fd4fdb08e
3:52:06 PM:   deployId: 63b6819a7d93c43fd4fdb090
3:52:06 PM: ​
3:52:06 PM: ❯ Current directory
3:52:06 PM:   /opt/build/repo
3:52:06 PM: ​
3:52:06 PM: ❯ Config file
3:52:06 PM:   No config file was defined: using default values.
3:52:06 PM: ​
3:52:06 PM: ❯ Context
3:52:06 PM:   production
3:52:06 PM: ​
3:52:06 PM:   1. Build command from Netlify app                             
3:52:06 PM: ────────────────────────────────────────────────────────────────
3:52:06 PM: ​
3:52:06 PM: $ npm run build-web
3:52:06 PM: > sanity-gatsby-portfolio@0.0.0 build-web
3:52:06 PM: > lerna bootstrap && (cd studio && SANITY_AUTH_TOKEN=$SANITY_DEPLOY_STUDIO_TOKEN npm run graphql-deploy) && (cd web && npm run build)
3:52:07 PM: lerna notice cli v4.0.0
3:52:07 PM: lerna info ci enabled
3:52:07 PM: lerna info Bootstrapping 2 packages
3:52:07 PM: lerna info Installing external dependencies
3:52:08 PM: lerna ERR! npm ci exited 1 in 'sanity-gatsby-portfolio-studio'
3:52:08 PM: lerna ERR! npm ci stderr:
3:52:08 PM: npm ERR! code ERESOLVE
3:52:08 PM: npm ERR! ERESOLVE could not resolve
3:52:08 PM: npm ERR!
3:52:08 PM: npm ERR! While resolving: eslint-config-standard@16.0.3
3:52:08 PM: npm ERR! Found: eslint@8.31.0
3:52:08 PM: npm ERR! node_modules/eslint
3:52:08 PM: npm ERR!   dev eslint@"^8.3.0" from the root project
3:52:08 PM: npm ERR!   peer eslint@"*" from @typescript-eslint/experimental-utils@1.13.0
3:52:08 PM: npm ERR!   node_modules/@typescript-eslint/experimental-utils
3:52:08 PM: npm ERR!     @typescript-eslint/experimental-utils@"1.13.0" from @typescript-eslint/parser@1.13.0
3:52:08 PM: npm ERR!     node_modules/prettier-eslint/node_modules/@typescript-eslint/parser
3:52:08 PM: npm ERR!       @typescript-eslint/parser@"^1.10.2" from prettier-eslint@9.0.2
3:52:08 PM: npm ERR!       node_modules/prettier-eslint
3:52:09 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
3:52:08 PM: npm ERR!         prettier-eslint@"^9.0.0" from prettier-eslint-cli@5.0.1
3:52:08 PM: npm ERR!         node_modules/prettier-eslint-cli
3:52:08 PM: npm ERR!   8 more (babel-eslint, eslint-plugin-es, eslint-plugin-import, ...)
3:52:08 PM: npm ERR!
3:52:08 PM: npm ERR! Could not resolve dependency:
3:52:08 PM: npm ERR! peer eslint@"^7.12.1" from eslint-config-standard@16.0.3
3:52:08 PM: npm ERR! node_modules/eslint-config-standard
3:52:08 PM: npm ERR!   dev eslint-config-standard@"^16.0.3" from the root project
3:52:08 PM: npm ERR!
3:52:08 PM: npm ERR! Conflicting peer dependency: eslint@7.32.0
3:52:08 PM: npm ERR! node_modules/eslint
3:52:08 PM: npm ERR!   peer eslint@"^7.12.1" from eslint-config-standard@16.0.3
3:52:08 PM: npm ERR!   node_modules/eslint-config-standard
3:52:08 PM: npm ERR!     dev eslint-config-standard@"^16.0.3" from the root project
3:52:08 PM: npm ERR!
3:52:08 PM: npm ERR! Fix the upstream dependency conflict, or retry
3:52:08 PM: npm ERR! this command with --force, or --legacy-peer-deps
3:52:08 PM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
3:52:08 PM: npm ERR!
3:52:08 PM: npm ERR! See /opt/buildhome/.npm/eresolve-report.txt for a full report.
3:52:08 PM: npm ERR! A complete log of this run can be found in:
3:52:08 PM: npm ERR!     /opt/buildhome/.npm/_logs/2023-01-05T07_52_07_543Z-debug-0.log
3:52:08 PM: lerna ERR! npm ci exited 1 in 'sanity-gatsby-portfolio-studio'
3:52:08 PM: lerna WARN complete Waiting for 1 child process to exit. CTRL-C to exit immediately.
3:52:08 PM: ​
3:52:08 PM:   "build.command" failed                                        
3:52:08 PM: ────────────────────────────────────────────────────────────────
3:52:08 PM: ​
3:52:08 PM:   Error message
3:52:08 PM:   Command failed with exit code 1: npm run build-web (https://ntl.fyi/exit-code-1)
3:52:08 PM: ​
3:52:08 PM:   Error location
3:52:08 PM:   In Build command from Netlify app:
3:52:08 PM:   npm run build-web
3:52:08 PM: ​
3:52:08 PM:   Resolved config
3:52:08 PM:   build:
3:52:08 PM:     base: /opt/build/repo
3:52:08 PM:     command: npm run build-web
3:52:08 PM:     commandOrigin: ui
3:52:08 PM:     environment:
3:52:08 PM:       - GATSBY_SANITY_DATASET
3:52:08 PM:       - GATSBY_SANITY_PROJECT_ID
3:52:08 PM:       - NODE_VERSION
3:52:08 PM:       - NPM_FLAGS
3:52:08 PM:       - SANITY_DEPLOY_STUDIO_TOKEN
3:52:08 PM:     publish: /opt/build/repo/web/public
3:52:08 PM:     publishOrigin: ui
3:52:09 PM: Caching artifacts
3:52:09 PM: Started saving node modules
3:52:09 PM: Finished saving node modules
3:52:09 PM: Started saving build plugins
3:52:09 PM: Finished saving build plugins
3:52:09 PM: Started saving pip cache
3:52:09 PM: Finished saving pip cache
3:52:09 PM: Started saving emacs cask dependencies
3:52:09 PM: Finished saving emacs cask dependencies
3:52:09 PM: Started saving maven dependencies
3:52:09 PM: Finished saving maven dependencies
3:52:09 PM: Started saving boot dependencies
3:52:09 PM: Finished saving boot dependencies
3:52:09 PM: Started saving rust rustup cache
3:52:09 PM: Finished saving rust rustup cache
3:52:09 PM: Started saving go dependencies
3:52:09 PM: Finished saving go dependencies
3:52:09 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
3:52:09 PM: Failing build: Failed to build site
3:52:09 PM: Finished processing build request in 12.764357644s

Hi @adamatronix ,

Are you using this plugin @netlify/plugin-emails? If so, there is known issue with using it with Gatsby. I look forward to your reply and we can work from there!

Hi, no, I am not using any netlify plugins.

Not sure if you guys are familiar with Sanity’s project setup, but they have a root folder with its own package.json, and web and studio folders with their own package.json.

The current build fails when trying to deploy the “web” project which is the main site. The dependency in question is “eslint-config-standard@16.0.3” which exists in the studio folder.

However, when deploying a separate Netlify project for the studio build, everything is fine.

Here are the two build commands, perhaps it is interfering with how Netlify is applying 'npm install --force":

 "build-studio": "(cd studio && npm run build)",
 "build-web": "lerna bootstrap && (cd studio && SANITY_AUTH_TOKEN=$SANITY_DEPLOY_STUDIO_TOKEN npm run graphql-deploy) && (cd web && npm run build)",

Hi @adamatronix :wave:t6: ,

The error relates to:

3:52:08 PM: npm ERR! Fix the upstream dependency conflict, or retry
3:52:08 PM: npm ERR! this command with --force, or --legacy-peer-deps

You could use this to fix but that is only possible on the step where we install node modules:

4:35:41 PM: Now using node v14.18.1 (npm v8.13.2)

Since this error is happening on another step of the build process. You will need to figure out how to force this flag in that particular step of the process.