react-boilerplate-cra-template icon indicating copy to clipboard operation
react-boilerplate-cra-template copied to clipboard

Unable to resolve dependency tree

Open Firebottle opened this issue 2 years ago • 3 comments

Description

While following the instructions to setup a new project via yarn, I've run into an error. "Unable to resolve dependency tree".

Could not resolve dependency: peer react@"^16.8.3 || ^17" from [email protected] node_modules/react-redux react-redux@"7.2.6" from [email protected] app [email protected] node_modules/app workspace app from the root project

Fix the upstream dependency conflict, or retry this command with --force, or --legacy-peer-deps to accept an incorrect (and potentially broken) dependency resolution.

Steps to reproduce

  1. Get yarn setup.
  2. Setup my workspace in package.json.
  3. Follow the "install & start" steps listed on the repo main page.
  4. Halfway through the install process the error will appear and stop the process.

Expected behavior The install process should finish with no issues.

Screenshots image

Versions

  • react-boilerplate-cra-template: current
  • Node/NPM: 8.12.2
  • Browser: Vivaldi

Firebottle avatar Jun 22 '22 14:06 Firebottle

The same error occurs when installing via npm (npm version 8.11.0, node version v16.15.1):

npx create-react-app --template cra-template-rb my-client
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
Need to install the following packages:
  create-react-app
Ok to proceed? (y) y
npm WARN deprecated [email protected]: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.

Creating a new React app in C:\Temp\my-client.

npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template-rb...

npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.

added 1450 packages in 1m

204 packages are looking for funding
  run `npm fund` for details

Initialized a git repository.

Installing template dependencies using npm...
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   react@"18.1.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.3 || ^17" from [email protected]
npm ERR! node_modules/react-redux
npm ERR!   react-redux@"7.2.6" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!

I think the issue is related to the fact that this project's package.json specifies React version 18, but this project also depends on react-redux, which requires React version 16 or 17.

This project changed from using React 17 to React 18 in the following PR, which was merged in late May, shortly before this issue was created: https://github.com/react-boilerplate/react-boilerplate-cra-template/pull/170

gitname avatar Jul 23 '22 18:07 gitname

https://github.com/react-boilerplate/react-boilerplate-cra-template/issues/96

does this help?

Can-Sahin avatar Aug 02 '22 13:08 Can-Sahin

Thanks, @Can-Sahin. I did find it informative, in that I learned that using yarn instead of npm would allow the installation to finish instead of fail. I would like to continue using npm since I use it for all my other projects, but that issue at least helps me understand what my options are.

gitname avatar Aug 02 '22 16:08 gitname