Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid Directory /Users/node_modules/superagent with React Native

I'm getting this error Invalid Directory /Users/node_modules/superagent with a React Native project. I'm not sure why it would be looking for the module in this location? How can I fix this to search for the module inside the node_modules directory of the React Native project where it is actually located?

like image 688
Spencer Pope Avatar asked Nov 21 '15 05:11

Spencer Pope


2 Answers

The problem is npm3. You have to downgrade it to npm2 because the flattened packages don't seem to work yet with react-native.

like image 153
JWindey Avatar answered Sep 27 '22 16:09

JWindey


I may be running into a similar issue over at Using PubNub with React Native

I used nvm to downgrade to Node v4.2.2 and then npm dropped itself automatically to 2.14.7. Re-created the React Native project (using react-native init) so that there was no longer a flat modules directory. However, still getting the same error when requiring.

like image 31
Fenda Avatar answered Sep 27 '22 16:09

Fenda