Build failed in netlify -with create react app

I am unable to build a simple create react app it was working earlier. not sure what is wrong. below are the logs

1:25:19 PM: Build ready to start
1:25:21 PM: build-image version: d2c6dbeac570350a387d832f64bc980dc964ad65 (focal)
1:25:21 PM: build-image tag: v4.8.0
1:25:21 PM: buildbot version: 4aaa27647e859c2d38cfbb25901ceae1e7f3eeae
1:25:21 PM: Fetching cached dependencies
1:25:24 PM: Finished downloading cache in 2.859800772s
1:25:24 PM: Starting to extract cache
1:25:37 PM: Finished extracting cache in 12.775838979s
1:25:37 PM: Finished fetching cache in 15.678659356s
1:25:37 PM: Starting to prepare the repo for build
1:25:37 PM: Preparing Git Reference refs/heads/dev
1:25:38 PM: Parsing package.json dependencies
1:25:39 PM: Starting build script
1:25:39 PM: Installing dependencies
1:25:40 PM: Python version set to 2.7
1:25:40 PM: Started restoring cached node version
1:25:41 PM: Finished restoring cached node version
1:25:42 PM: Downloading and installing node v16.15.1…
1:25:42 PM: Downloading https://nodejs.org/dist/v16.15.1/node-v16.15.1-linux-x64.tar.xz
1:25:42 PM: Computing checksum with sha256sum
1:25:42 PM: Checksums matched!
1:25:45 PM: Now using node v16.15.1 (npm v8.11.0)
1:25:45 PM: Started restoring cached build plugins
1:25:45 PM: Finished restoring cached build plugins
1:25:45 PM: Attempting ruby version 2.7.2, read from environment
1:25:46 PM: Using ruby version 2.7.2
1:25:46 PM: Using PHP version 8.0
1:25:46 PM: No npm workspaces detected
1:25:46 PM: Started restoring cached node modules
1:25:46 PM: Finished restoring cached node modules
1:25:47 PM: Installing NPM modules using NPM version 8.11.0
1:25:47 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
1:25:47 PM: npm WARN config location in the cache, and they are managed by
1:25:47 PM: npm WARN config cacache.
1:25:47 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
1:25:47 PM: npm WARN config location in the cache, and they are managed by
1:25:47 PM: npm WARN config cacache.
1:25:52 PM: npm ERR! code ERESOLVE
1:25:53 PM: npm ERR! ERESOLVE could not resolve
1:25:53 PM: npm ERR!
1:25:53 PM: npm ERR! While resolving: react-lottie@1.2.3
1:25:53 PM: npm ERR! Found: react@17.0.2
1:25:53 PM: Creating deploy upload records
1:25:53 PM: npm ERR! node_modules/react
1:25:53 PM: npm ERR! react@“^17.0.2” from the root project
1:25:53 PM: npm ERR! peerOptional react@“^16.8.0 || ^17.0.0” from @apollo/client@3.5.6
1:25:53 PM: npm ERR! node_modules/@apollo/client
1:25:53 PM: npm ERR! @apollo/client@“^3.5.6” from the root project
1:25:53 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 1 (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
1:25:53 PM: npm ERR! 115 more (@chakra-ui/accordion, @chakra-ui/icon, …)
1:25:53 PM: npm ERR!
1:25:53 PM: npm ERR! Could not resolve dependency:
1:25:53 PM: npm ERR! peer react@“^0.14.7 || ^15.0.0 || ^16.0.0” from react-lottie@1.2.3
1:25:53 PM: npm ERR! node_modules/react-lottie
1:25:53 PM: npm ERR! react-lottie@“^1.2.3” from the root project
1:25:53 PM: npm ERR!
1:25:53 PM: npm ERR! Conflicting peer dependency: react@16.14.0
1:25:53 PM: npm ERR! node_modules/react
1:25:53 PM: npm ERR! peer react@“^0.14.7 || ^15.0.0 || ^16.0.0” from react-lottie@1.2.3
1:25:53 PM: npm ERR! node_modules/react-lottie
1:25:53 PM: npm ERR! react-lottie@“^1.2.3” from the root project
1:25:53 PM: npm ERR!
1:25:53 PM: npm ERR! Fix the upstream dependency conflict, or retry
1:25:53 PM: npm ERR! this command with --force, or --legacy-peer-deps
1:25:53 PM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
1:25:53 PM: npm ERR!
1:25:53 PM: npm ERR! See /opt/buildhome/.npm/eresolve-report.txt for a full report.
1:25:53 PM: npm ERR! A complete log of this run can be found in:
1:25:53 PM: npm ERR! /opt/buildhome/.npm/_logs/2022-06-02T07_55_47_712Z-debug-0.log
1:25:53 PM: Error during NPM install
1:25:53 PM: Build was terminated: Build script returned non-zero exit code: 1
1:25:53 PM: Failing build: Failed to build site
1:25:53 PM: Finished processing build request in 32.046732833s

1 Like

I was running into this same issue, turns out that Node updated v16.15.0 to v16.15.1, which changed npm from v8.5.5 to v8.11.0.

For some reason, Netlify is not able to build using v8.11.0.

To fix this, change your Node version back to v16.15.0. Either create a .nvmrc file with the content v16.15.0 in your site’s root folder, or create the environmental variable NODE_VERSION with the content 16.15.0 in Netlify’s dashboard.

3 Likes

Thanks, it also works for me in this issue!
I made environment variables NODE_VERSION = 16.15.0

1 Like

So glad this thread got you on the right track. Happy building :rocket: