Patrick Connors
Patrick Connors

Reputation: 6065

npm install breaks react-native app created with expo

I'm currently working with what is essentially the default stub code that is shipped when creating an app with expo (I've created a few different screens and done some styling). However, whenever I run any npm install command in my app's directory, the app becomes riddled with various dependency errors.

Terminal out put after npm install redux --save redux react-redux

npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
npm WARN package.json [email protected] No license field.
npm WARN unmet dependency ../app/node_modules/@expo/ex-navigation requires react-redux@'^4.4.5' but will load
npm WARN unmet dependency ../app/node_modules/react-redux,
npm WARN unmet dependency which is version 5.0.5
npm ERR! Darwin 16.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--save" "redux" "react-redux"
npm ERR! node v4.2.2
npm ERR! npm  v2.15.12
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package [email protected] does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants [email protected]
npm ERR! peerinvalid Peer [email protected] wants react@>=15.3.1
npm ERR! peerinvalid Peer [email protected] wants react@>=15.4.0
npm ERR! peerinvalid Peer [email protected] wants react@*
npm ERR! peerinvalid Peer [email protected] wants react@*
npm ERR! peerinvalid Peer [email protected] wants react@>=15.4.0
npm ERR! peerinvalid Peer [email protected] wants [email protected]
npm ERR! peerinvalid Peer [email protected] wants react@*
npm ERR! peerinvalid Peer [email protected] wants react@^0.14.0 || ^15.0.0-0 || ^16.0.0-0
npm ERR! peerinvalid Peer [email protected] wants react@^0.13.0 || ^0.14.0 || ^15.0.0
npm ERR! peerinvalid Peer [email protected] wants react@^16.0.0-alpha.6

npm ERR! Please include the following file with any support request:
npm ERR!     ../app/npm-debug.log

Below is the output received in the ios simulator:

Unable to resolve module `react-redux/lib/utils/storeShape` from `../app/node_modules/@expo/ex-navigation/src/ExNavigationProvider.js`: Module does not exist in the module map or in these directories:

      ../app/node_modules/react-redux/lib/utils
    ,   ../app/node_modules/react-redux/lib/utils

When I attempt to remove and reinstall the node modules folder or reinstall npm, I receive multiple peerDependencies warning followed by install errors. I've tried installing various packages in clean projects and the results are similar. It seems as if others have had problems with node dependencies when working with expo.

Upvotes: 3

Views: 1584

Answers (1)

ide
ide

Reputation: 20788

It looks like you're using npm 2, which isn't supported since create-react-native-app depends in some way upon the flattening behavior of npm 3+ and Yarn.

React Native also best supports Node 6 and up, so I'd recommend upgrading Node as well.

Upvotes: 3

Related Questions