Skip to content

npm install fails because restrictive react semver #578

Closed
@wilson0x4d

Description

@wilson0x4d

Current behavior

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: undefined@undefined
npm ERR! Found: react@16.14.0
npm ERR! node_modules/react
npm ERR!   react@"^16.14.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"~16.8.6 || ~16.9.0 || ~16.11.0 || ~16.13.1 || ~17.0.1" from @react-native-async-storage/async-storage@1.13.4
npm ERR! node_modules/@react-native-async-storage/async-storage
npm ERR!   @react-native-async-storage/async-storage@"~1.13.4" from the root project
npm ERR! 

Expected behavior

successful package restore for all ^16.x.x releases.

Repro steps

- load/create any react project targeting react ^16.
- update to latest packages, causing react to upgrade to ^16.14.0 (latest v16 release)
- attempt to install @react-native-async-storage/async-storage 
! install fails because peerDependencies semver cosntraints of async-storage

To simulate a pre-existing project which was working fine until recently:

- init a new application with package.json
- edit package.json to specify react ^16.14.0
- edit package.json to specify @react-native-async-storage/async-storage ^1.13.4
- from cli, attempt `npm install`
! install fails because peerDependencies semver constraints of async-storage

Environment

  • Platforms tested:
    • Android
    • iOS
    • macOS
    • Windows
  • AsyncStorage version: multiple.
  • Expo version: 4
  • Environment:
    npm install is failing.
  • Logs/Errors that may be relevant:

Please consider the following suggested peer deps:

  "peerDependencies": {
    "react": "^16.8.6 || ~17.0.1",
    "react-native": "^0.60.6 || ^0.61.5 || ^0.62.2 || ^0.63.2 || ^0.64.0 || 1000.0.0"
  },
  "peerDependencies": {
    "react": "~16.8.6 || ~16.9.0 || ~16.11.0 || ~16.13.1 || ~16.14.0 || ~17.0.1",
    "react-native": "^0.60.6 || ^0.61.5 || ^0.62.2 || ^0.63.2 || ^0.64.0 || 1000.0.0"
  },

I believe for react it makes more sense to target the major version for compatibility, ie. all releases of v16 should be compatible from a downstream perspective, and a semver constraint of ^16.8.6 should allow every v16 release from 16.8 up to but not including v17.0.0 or beyond. It would also be convenient if the same approach was taken for v17.x -- but I'm only concerned about not being forced to upgrade non-deprecated versions of react to use this package.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions