Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Unable to resolve module" from dependency #3874

Closed
jeromecovington opened this issue Nov 3, 2015 · 15 comments
Closed

"Unable to resolve module" from dependency #3874

jeromecovington opened this issue Nov 3, 2015 · 15 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@jeromecovington
Copy link

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?

@jeromecovington
Copy link
Author

For example, a representative sample from errors logged in terminal:

Unable to resolve module net from /Users/jcovingt/vogue-clutch/node_modules/request-promise/node_modules/request/node_modules/tough-cookie/lib/cookie.js
Unable to resolve module url from /Users/jcovingt/vogue-clutch/node_modules/request-promise/node_modules/request/node_modules/tough-cookie/lib/cookie.js
Unable to resolve module punycode from /Users/jcovingt/vogue-clutch/node_modules/request-promise/node_modules/request/node_modules/tough-cookie/lib/cookie.js
Unable to resolve module punycode from /Users/jcovingt/vogue-clutch/node_modules/request-promise/node_modules/request/node_modules/tough-cookie/lib/pubsuffix.js
Unable to resolve module util from /Users/jcovingt/vogue-clutch/node_modules/request-promise/node_modules/request/node_modules/tough-cookie/lib/memstore.js
Unable to resolve module crypto from /Users/jcovingt/vogue-clutch/node_modules/request-promise/node_modules/request/lib/helpers.js
Unable to resolve module http from /Users/jcovingt/vogue-clutch/node_modules/request-promise/node_modules/request/request.js
Unable to resolve module https from /Users/jcovingt/vogue-clutch/node_modules/request-promise/node_modules/request/request.js
Unable to resolve module url from /Users/jcovingt/vogue-clutch/node_modules/request-promise/node_modules/request/request.js
Unable to resolve module util from /Users/jcovingt/vogue-clutch/node_modules/request-promise/node_modules/request/request.js
Unable to resolve module stream from /Users/jcovingt/vogue-clutch/node_modules/request-promise/node_modules/request/request.js
Unable to resolve module zlib from /Users/jcovingt/vogue-clutch/node_modules/request-promise/node_modules/request/request.js

These all appear to be node core modules. Are there known issues with dependencies that require node core modules breaking the packager?

@jeromecovington
Copy link
Author

See - #1871

@zsszatmari
Copy link

+1

@skevy
Copy link
Contributor

skevy commented Dec 11, 2015

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?

@deminoth
Copy link
Contributor

Checkout #4062.

@satya164
Copy link
Contributor

@skevy May be we should add these steps to react-native upgrade?

@skevy
Copy link
Contributor

skevy commented Dec 19, 2015

@satya164 seems reasonable to me.

@satya164
Copy link
Contributor

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

themichaellai added a commit to dukechronicle/chron-react that referenced this issue Dec 31, 2015
@abeauvois
Copy link

+1 @skevy

@ovpv
Copy link

ovpv commented Aug 22, 2016

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.

@faogustavo
Copy link

Any solution? I'm stuck on this. :/

@dsapoetra
Copy link

I'm stuck at this too, hoping someone could give any advice/clue on this

@mpm
Copy link

mpm commented Jul 14, 2017

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.

@phantom1299
Copy link

There is a blog post in medium explaning how to use core node modules with react-native:
https://medium.com/@aakashns/using-core-node-js-modules-in-react-native-apps-64acd4d07140

Maybe it helps

@ps06756
Copy link

ps06756 commented Jun 17, 2018

Why do you people close issues, if there is no clearly identified solution to the problem, and there are so many people facing the same issue ?

@facebook facebook locked as resolved and limited conversation to collaborators Jul 20, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests