2
votes

What is the best way to deal with solving a peer dependency issue in React Native when using Expo? I am stuck with a peer dependency error. I didn’t install any new packages to cause a new peer dependency, what happened is I got a node modules error (as does happen in RN sometimes) and I had to blow away and reinstall all my node modules.

I think that something got out of sync when this I re-instantiated my node modules. Any ideas on how to get around it? I have tried making my package.json specifically versioned but I haven’t found the right setup. FWIT Expo is throwing me this warning:

“Warning: ‘firebase’ peer depencency missing”

When I run

npm install OR npm ls

I get the following messages:

enter image description here

FWIT: my package.json looks like this

{
  "name": "RN-expo",
  "version": "0.0.0",
  "description": "Hello Expo!",
  "author": null,
  "private": true,
  "main": "main.js",
  "dependencies": {
    "expo": "17.0.0",
    "firebase": "4.1.2",
    "geofire": "^4.1.2",
    "lodash": "^4.17.4",
    "moment": "^2.18.1",
    "react": "16.0.0-alpha.6",
    "react-native": "https://github.com/expo/react-native/archive/sdk-17.0.0.tar.gz",
    "react-native-gifted-chat": "^0.1.4",
    "react-native-modal-dropdown": "^0.4.4",
    "react-native-multislider": "0.0.14",
    "react-native-vector-icons": "^4.2.0",
    "react-navigation": "git+https://github.com/react-community/react-navigation.git"
  },
  "devDependencies": {
    "standard": "^10.0.2"
  }
}

These errors are not occurring on anyone else's computers on my team, so I think it has something to do with the node dependencies on my computer. I have completely uninstalled all node / npm related material on my computer and attempted to reinstall it to see if it solved the issue.

While scrolling through the npm ls I see the the "UNMET PEER DEPENDENCIES" are:

Any suggestions on how to go about solving this?

1

1 Answers

2
votes

From what I can see in your package.json, I'd expect your teammates also to encounter the same warnings.

The warning between geofire and firebase is because you're using [email protected] but geofire wants firebase 3.x. Often (but also often not) libraries like geofire will work with newer versions of their peer dependencies, so I recommend asking the authors of geofire if it'd work with [email protected].

The other warnings between React Native packages and React are spurious. For example, react-native-maps says it accepts react >= 15.4.0 and you're using [email protected], which is clearly greater than 15.4.0. This has been addressed by Yarn, which detects that [email protected] satisfies the requirement of react >= 15.4.0.

All this is to say that I'd expect you to see the warnings that you're seeing, and that the firebase one is legitimate and you can ignore the react one.