assaf / node-replay

When API testing slows you down: record and replay HTTP responses like a boss
http://documentup.com/assaf/node-replay
MIT License
522 stars 107 forks source link

Module not found: Can't resolve 'dns' #131

Open nicolasiensen opened 7 years ago

nicolasiensen commented 7 years ago

Whenever I try to require('replay') in my app, I get an error saying:

./~/replay/lib/patch_dns_lookup.js
Module not found: Can't resolve 'dns' in '/Users/nicolasiensen/Projects/t-inbox-client/node_modules/replay/lib'

I'm using create-react-app to abstract the Webpack configuration, the replay version is 2.1.2 and the node version is 7.10.0.

I've tried to install dns package, but it fails since one of its dependencies requires a very old version of node:

yarn add dns
...
error hawk@0.10.2: The engine "node" is incompatible with this module. Expected version "0.8.x".
error Found incompatible module
...

Is this a known issue? Why dns is not listed in the replay dependencies? Thanks in advance!

assaf commented 7 years ago

The dos module is part of Node.js.

nicolasiensen commented 7 years ago

Thanks for the answer, @assaf. But I still don't understand why dns can't be found since it is part of Node.js 😕

Vladislav1552 commented 6 years ago

Faced the same problem, write if you could solve

Yahyawi73 commented 5 years ago

You simply can't have nodemailer in the frontend. Nodemailer and other projects depending on it (i.e. gmail-send) are made for nodejs use in the backend.

Instead, you should look into either using a 3rd party smtp service like AWS-SES or make your own by using nodemailer in the backend and the front end would invoke it through something like https requests.

I get this from https://stackoverflow.com/questions/45155660/cant-resolve-dns-and-child-process-when-using-nodemailer-and-webpack