router icon indicating copy to clipboard operation
router copied to clipboard

Peer dependency error with react-location-devtools

Open AnimaLupi opened this issue 2 years ago • 2 comments

Describe the bug

Hello, I'm experiencing this behaviour while installing the latest packages (see below).

Not a real issue, it's just a little bit annoying to force on all npm install I do (it complains even when installing other packages at later times), but I just wanted to report this in case nobody was aware yet.

Thank you for the awesome library by the way!

Your Example Website or App

N/A

Steps to Reproduce the Bug or Issue

Package.json containing:

"@tanstack/react-location": "^3.7.4",
"@tanstack/react-location-devtools": "^3.4.4"

(I wasn't unable to find a devtool version matching the react-location one)

When I run npm install I'm getting these errors:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @tanstack/[email protected]
npm ERR! Found: @tanstack/[email protected]
npm ERR! node_modules/@tanstack/react-location
npm ERR!   @tanstack/react-location@"^3.7.4" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @tanstack/react-location@"3.4.4" from @tanstack/[email protected]
npm ERR! node_modules/@tanstack/react-location-devtools
npm ERR!   dev @tanstack/react-location-devtools@"^3.4.4" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: @tanstack/[email protected]
npm ERR! node_modules/@tanstack/react-location
npm ERR!   peer @tanstack/react-location@"3.4.4" from @tanstack/[email protected]
npm ERR!   node_modules/@tanstack/react-location-devtools
npm ERR!     dev @tanstack/react-location-devtools@"^3.4.4" 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.

If I run the command with the -f (force) switch, errors turn into warnings, the installation succeeds and I can see the devtools running in the app.

Expected behavior

Installation shouldn't give errors and proceed without the need to force it.

Screenshots or Videos

No response

Platform

  • OS: Linux
  • Browser: N/A
  • Version: N/A
  • NodeJS: 16.14.2
  • npm: 8.6.0

Additional context

No response

AnimaLupi avatar Apr 07 '22 08:04 AnimaLupi

You can use npm 7 overrides:

"overrides": {
  "@tanstack/react-location-devtools": {
    "@tanstack/react-location": "^3.7.4"
  }
},

In addition to this, the docs are really confusing, as they state: No need to install anything extra, just: import { ReactLocationDevtools } from '@tanstack/react-location-devtools' which doesn't appear to be the case. This is not a great DX when trying to use this library for this first time.

badsyntax avatar Jun 14 '22 05:06 badsyntax

Or with pnpm, you can use allowedversions:

  "pnpm": {
    "peerDependencyRules": {
      "allowedVersions": {
        "@tanstack/react-location": "3.7.4"
      }
    }
  }

jimmy-guzman avatar Oct 13 '22 02:10 jimmy-guzman