-2

I'm trying to deploy my website on Netlify, but for some reason, I'm running into dependency issues.

I'm not sure what I need to resolve here. Is it because I'm using an older version of React?

Please, any help would be appreciated.

Here are my logs:

8:10:18 PM: npm ERR! code ERESOLVE
8:10:18 PM: npm ERR! ERESOLVE could not resolve
8:10:18 PM: npm ERR!
8:10:18 PM: npm ERR! While resolving: gatsby-plugin-transition-link@1.20.5
8:10:18 PM: Creating deploy upload records
8:10:18 PM: npm ERR! Found: react@17.0.2
8:10:18 PM: npm ERR! node_modules/react
8:10:18 PM: npm ERR!   react@"^17.0.1" from the root project
8:10:18 PM: npm ERR!   peer react@"15.x || 16.x || 17.x" from @gatsbyjs/reach-router@1.3.6
8:10:18 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1 (https://ntl.fyi/exit-code-1)
8:10:18 PM: npm ERR!   node_modules/@gatsbyjs/reach-router
8:10:18 PM: npm ERR!     @gatsbyjs/reach-router@"^1.3.6" from gatsby@3.10.2
8:10:18 PM: npm ERR!     node_modules/gatsby
8:10:18 PM: npm ERR!       gatsby@"^3.9.1" from the root project
8:10:18 PM: npm ERR!       19 more (babel-plugin-remove-graphql-queries, ...)
8:10:18 PM: npm ERR!     peer @gatsbyjs/reach-router@"^1.3.5" from gatsby-link@3.10.0
8:10:18 PM: npm ERR!     node_modules/gatsby-link
8:10:18 PM: npm ERR!       gatsby-link@"^3.10.0" from gatsby@3.10.2
8:10:18 PM: npm ERR!       node_modules/gatsby
8:10:18 PM: npm ERR!         gatsby@"^3.9.1" from the root project
8:10:18 PM: npm ERR!         19 more (babel-plugin-remove-graphql-queries, ...)
8:10:18 PM: npm ERR!     1 more (gatsby-react-router-scroll)
8:10:18 PM: npm ERR!   10 more (gatsby, gatsby-link, gatsby-plugin-image, ...)
8:10:18 PM: npm ERR!
8:10:18 PM: npm ERR! Could not resolve dependency:
8:10:18 PM: npm ERR! peer react@"^16.8.5" from gatsby-plugin-transition-link@1.20.5
8:10:18 PM: npm ERR! node_modules/gatsby-plugin-transition-link
8:10:18 PM: npm ERR!   gatsby-plugin-transition-link@"^1.20.5" from the root project
8:10:18 PM: npm ERR!
8:10:18 PM: npm ERR! Conflicting peer dependency: react@16.14.0
8:10:18 PM: npm ERR! node_modules/react
8:10:18 PM: npm ERR!   peer react@"^16.8.5" from gatsby-plugin-transition-link@1.20.5
8:10:18 PM: npm ERR!   node_modules/gatsby-plugin-transition-link
8:10:18 PM: npm ERR!     gatsby-plugin-transition-link@"^1.20.5" from the root project
8:10:18 PM: npm ERR!
8:10:18 PM: npm ERR! Fix the upstream dependency conflict, or retry
8:10:18 PM: npm ERR! this command with --force, or --legacy-peer-deps
8:10:18 PM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
8:10:18 PM: npm ERR!
8:10:18 PM: npm ERR! See /opt/buildhome/.npm/eresolve-report.txt for a full report.
8:10:18 PM: npm ERR! A complete log of this run can be found in:
8:10:18 PM: npm ERR!     /opt/buildhome/.npm/_logs/2022-09-16T01_10_16_590Z-debug-0.log
8:10:18 PM: Error during NPM install
8:10:18 PM: Build was terminated: Build script returned non-zero exit code: 1
8:10:18 PM: Failing build: Failed to build site
8:10:18 PM: Finished processing build request in 12.393793987s
Zed
  • 167
  • 2
  • 15

2 Answers2

1

This line says you are using react v17.0.2 and gatsby-plugin-transition-link v1.20.5:

8:10:18 PM: npm ERR! While resolving: gatsby-plugin-transition-link@1.20.5
8:10:18 PM: Creating deploy upload records
8:10:18 PM: npm ERR! Found: react@17.0.2

This line says gatsby-plugin-transition-link v1.20.5 needs react v16.8.5 as peer dependency.

8:10:18 PM: npm ERR! Could not resolve dependency:
8:10:18 PM: npm ERR! peer react@"^16.8.5" from gatsby-plugin-transition-link@1.20.5
8:10:18 PM: npm ERR! node_modules/gatsby-plugin-transition-link
8:10:18 PM: npm ERR!   gatsby-plugin-transition-link@"^1.20.5" from the root project

So to solve this, either downgrade react to v16 or get a version of gatsby-plugin-transition-link that supports react v17, if that exists.

https://stackoverflow.com/a/73703524/1846040

Andy Refuerzo
  • 3,312
  • 1
  • 31
  • 38
0

Try running this command on the project repository before building the site

npm config set legacy-peer-deps true