react-native: "Unable to resolve module" from dependency

In this case, I am requiring request-promise, but when I start the react native project, I get the error: Unable to resolve module x. If you are sure the module is there, try restarting the packager.

This error is reported for many of the required dependencies of the request dependency of request-promise. I have restarted the packager as well as removing node_modules and reinstalling. In general, what does this error stem from and in the specific, what can be done to solve it?

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 15 (5 by maintainers)

Commits related to this issue

Most upvoted comments

Hey everyone, can you all try:

  1. upgrading to latest RN
  2. watchman watch-del-all
  3. rm -rf $TMPDIR/react-native-packager-*
  4. restart the packager

And let me know if that fixes the issue?

Node core modules cannot be used inside React Native as it’s a completely different environment. closing this.

I came here after having trouble importing the a Wordpress REST API wrapper for node.js. I had the same issue with unable to resolve module url. I took inspiration from a similar issue and solved it by running

npm install --save url (and subsequentially installing a package named util as well).

As @satya164 pointed out, this will probably not work for all missing modules, but in my case it was only url and util and works now.

Pay attention to the react error screen to find out what other modules are missing.

My development is stuck at this error. i have researched a lot on this but i found no perfect solution for this! Moreover , it is quite surprising to find an issue not resolved for the span of more than a year.

please guys, do share if you find any solution for this.