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
Oct 21, 2022, 3:14 PM
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
Oct 21, 2022, 3:14 PM
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
Oct 21, 2022, 3:18 PM
(Also, thank you for not spamming a long log in the main channel as too many people do 😓)
Oct 21, 2022, 3:18 PM
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
Oct 21, 2022, 3:23 PM
and haha no prob, i was trying to avoid being that person 😅
Oct 21, 2022, 3:24 PM
if the point is informing the sanity team, id just recommend making a ticket on github
Oct 21, 2022, 3:27 PM
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)
Oct 21, 2022, 3:27 PM
good point, looks like there’s already an issue raised for it, i added a 👍
Oct 21, 2022, 3:30 PM
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!)
Oct 21, 2022, 9:53 PM
using
--legacy-peer-deps
did work though, thanks for the tip
Oct 21, 2022, 9:53 PM

Sanity– build remarkable experiences at scale

The Sanity Composable Content Cloud is the headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?