React-native-permissions: Unable to resolve dependency tree

Created on 24 Mar 2021  路  6Comments  路  Source: zoontek/react-native-permissions

Bug report

Summary

Screenshot 2021-03-24 at 13 54 55

Environment info

react-native info output:

System:
    OS: macOS 11.2.1
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 179.39 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 12.20.0 - ~/.nvm/versions/node/v12.20.0/bin/node
    Yarn: Not Found
    npm: 7.5.4 - ~/.nvm/versions/node/v12.20.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.0 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.3, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
    Android SDK: Not Found
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.6953283
    Xcode: 12.3/12C33 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.9.1 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: Not Found
    react-native: Not Found
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Library version: 0.63.4

Steps to reproduce

  1. npm install react-native-permissions
  2. npm i

Most helpful comment

I was really curious about this so I read that stackoverflow (good link @zoontek thanks)

peerDependencies still seems valid, but people have gotten lazy keeping them correct because npm was always ignoring them - both on the maintainer side not really keeping the ranges correct and the consumer side not really keeping things up to date.

Looks like npm7 is going to change the world there, everyone needs to get a lot more proactive

To the OP: this package depends on react-native-windows at >= 0.62 which could use react v16 (what you appear to have, based on the image you actually posted) but you installed react-native-windows at 0.64+ (based on the actually posted image) and that depends on react v17, so either upgrade your react to v17 to solve the tangle or tell npm to use "legacy-peer-deps" (aka, my peer dependencies are broken and I don't want to fix them so please ignore them like you used to)

The problem appears to be your project has incompatible react-native-windows and react versions, and npm is just enforcing that now with npm v7

I don't think it's a problem with react-native-permissions, as the peerDependencies here are all easy to satisfy ranges:

https://github.com/zoontek/react-native-permissions/blob/22588a076bb440e94aac6941b6b59cfa5763b586/package.json#L62-L66

All 6 comments

Which version of npm are you using? If you are using npm v7, try install deps with --legacy-peer-deps

Confirmed, it seems linked: https://stackoverflow.com/questions/64573177/unable-to-resolve-dependency-tree-error-when-installing-npm-packages

I will try fo find what it is now recommended (dropping peerDependencies usage entirely?)

I was really curious about this so I read that stackoverflow (good link @zoontek thanks)

peerDependencies still seems valid, but people have gotten lazy keeping them correct because npm was always ignoring them - both on the maintainer side not really keeping the ranges correct and the consumer side not really keeping things up to date.

Looks like npm7 is going to change the world there, everyone needs to get a lot more proactive

To the OP: this package depends on react-native-windows at >= 0.62 which could use react v16 (what you appear to have, based on the image you actually posted) but you installed react-native-windows at 0.64+ (based on the actually posted image) and that depends on react v17, so either upgrade your react to v17 to solve the tangle or tell npm to use "legacy-peer-deps" (aka, my peer dependencies are broken and I don't want to fix them so please ignore them like you used to)

The problem appears to be your project has incompatible react-native-windows and react versions, and npm is just enforcing that now with npm v7

I don't think it's a problem with react-native-permissions, as the peerDependencies here are all easy to satisfy ranges:

https://github.com/zoontek/react-native-permissions/blob/22588a076bb440e94aac6941b6b59cfa5763b586/package.json#L62-L66

Just take more time to check if it's an issue with the package, and @mikehardy seems right here.
I think we can close this issue for now.

This is happening with node 14. With node 12 its able to install

@ankitbaid11326 there is no such thing as npm 14.

There is a node 14. There is an npm 7. npm 7 exhibits the issue (as noted above) but if I understand correctly you can if you like update npm 6 which came during the npm12 (and npm14!) era to npm 7 in those node installations.

So be careful, and do not confuse different tools and different versions, or you will have confused results

Was this page helpful?
0 / 5 - 0 ratings