Error with `sanity-nextjs-landing-pages` starter during Netlify build

10 replies
Last updated: Oct 21, 2022
hi all - not sure if this is the right place for this, but was trying out the
sanity-nextjs-landing-pages
starter and got an error during the initial netlify build of the front-end
AI Update

I can see you're running into build errors with the sanity-nextjs-landing-pages starter on Netlify. Build errors with older Sanity starters are unfortunately quite common, typically due to dependency conflicts and outdated packages that don't play well with current build environments.

Troubleshooting your current setup

If you want to continue with this specific template, the Netlify build error is likely caused by:

  • Outdated dependencies - Older Next.js versions or Sanity packages that conflict with current build environments
  • Node.js version mismatch - Netlify might be using a different Node version than the template expects
  • ESLint configuration issues - Common with older templates using deprecated ESLint configs

You can try setting the Node.js version explicitly in Netlify by adding a .nvmrc file to your repo or setting the NODE_VERSION environment variable in your Netlify dashboard.

Consider using current templates instead

Rather than debugging an older template, I'd recommend starting with one of Sanity's actively maintained starters. According to the official Sanity templates page, there are over 100 official templates and 1,200+ community templates available, including:

  • 382 Next.js templates specifically designed for modern Next.js + Sanity projects
  • 334 marketing site templates if you're building landing pages
  • Templates with built-in support for features like collaborative editing, localization, and optimization

You can browse all available templates at sanity.io/templates and filter by framework, use case, and features.

Why modern templates matter

Starting with a current template means:

  • Dependencies are compatible with modern build platforms like Netlify
  • You get access to newer Sanity features like Content Releases and the Live Content API
  • Active community support and regular updates
  • Better performance and developer experience

If you need specific help with the exact error message you're seeing, sharing the full error output in the Sanity Slack community would help folks provide more targeted debugging advice!

10:14:42 AM: Installing NPM modules using NPM version 8.19.2
10:14:43 AM: npm ERR! code ERESOLVE
10:14:43 AM: npm ERR! ERESOLVE could not resolve
10:14:43 AM: npm ERR!
10:14:43 AM: Creating deploy upload records
10:14:43 AM: npm ERR! While resolving: eslint-config-standard@16.0.3
10:14:43 AM: npm ERR! Found: eslint@8.8.0
10:14:43 AM: npm ERR! node_modules/eslint
10:14:43 AM: npm ERR!   dev eslint@"^8.8.0" from the root project
10:14:43 AM: npm ERR!   peer eslint@"^6.0.0 || ^7.0.0 || ^8.0.0" from @typescript-eslint/parser@5.10.2
10:14:43 AM: Failed during stage 'building site': Build script returned non-zero exit code: 1 (<https://ntl.fyi/exit-code-1>)
10:14:43 AM: npm ERR!   node_modules/@typescript-eslint/parser
10:14:43 AM: npm ERR!     @typescript-eslint/parser@"^5.0.0" from eslint-config-next@12.0.10
10:14:43 AM: npm ERR!     node_modules/eslint-config-next
10:14:43 AM: npm ERR!       dev eslint-config-next@"^12.0.10" from the root project
10:14:43 AM: npm ERR!   12 more (eslint-config-next, eslint-config-prettier, ...)
10:14:43 AM: npm ERR!
10:14:43 AM: npm ERR! Could not resolve dependency:
10:14:43 AM: npm ERR! peer eslint@"^7.12.1" from eslint-config-standard@16.0.3
10:14:43 AM: npm ERR! node_modules/eslint-config-standard
10:14:43 AM: npm ERR!   dev eslint-config-standard@"^16.0.3" from the root project
10:14:43 AM: npm ERR!
10:14:43 AM: npm ERR! Conflicting peer dependency: eslint@7.32.0
10:14:43 AM: npm ERR! node_modules/eslint
10:14:43 AM: npm ERR!   peer eslint@"^7.12.1" from eslint-config-standard@16.0.3
10:14:43 AM: npm ERR!   node_modules/eslint-config-standard
10:14:43 AM: npm ERR!     dev eslint-config-standard@"^16.0.3" from the root project
10:14:43 AM: npm ERR!
10:14:43 AM: npm ERR! Fix the upstream dependency conflict, or retry
10:14:43 AM: npm ERR! this command with --force, or --legacy-peer-deps
10:14:43 AM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
10:14:43 AM: npm ERR!
10:14:43 AM: npm ERR! See /opt/buildhome/.npm/eresolve-report.txt for a full report.
10:14:43 AM: npm ERR! A complete log of this run can be found in:
10:14:43 AM: npm ERR!     /opt/buildhome/.npm/_logs/2022-10-21T14_14_43_105Z-debug-0.log
10:14:43 AM: Error during NPM install
10:14:43 AM: Build was terminated: Build script returned non-zero exit code: 1
10:14:43 AM: Failing build: Failed to build site
10:14:43 AM: Finished processing build request in 6.20197214s
Im not 100%, but it seems like this starter was made using an older version of npm where peer dependencies werent being forced.
A workaround would be using
--legacy-peer-deps
, but a fix would be updating your dependencies in such a way to make them compatible
(Also, thank you for not spamming a long log in the main channel as too many people do šŸ˜“)
thanks for the quick reply! hmm i was able to do an
npm install
successfully locally, and i’m using the same version of npm (8.19.2) as the netlify build… i’ll have to see how i can pass that arg to the netlify build process, or yeah just update my dependencies…
also just wanted to report this to the sanity team so that they’re aware their starter is failing the build for other people who may be trying it
and haha no prob, i was trying to avoid being that person šŸ˜…
if the point is informing the sanity team, id just recommend making a ticket on github
might it be that you locally use
npm
and the netlify pipeline uses yarn? (not saying it does, trying to think of possibly causes given an equal npm version)
good point, looks like there’s already an issue raised for it, i added a šŸ‘
btw, i misspoke earlier - the npm install in the root worked but the one in
web
and
studio
get the same error (at least it’s consistent!)
using
--legacy-peer-deps
did work though, thanks for the tip

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?