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

Cannot resolve module 'child_process' , 'fs' , 'net' - youtube-dl with webpack #2142

Closed
nicksparks opened this issue Mar 5, 2016 · 3 comments
Labels

Comments

@nicksparks
Copy link

Hello everyone
i just couldn't set up webpack and youtube-dl and some other modules like shelljs

if i run in terminal "node my_Youtube_dl_Script.js" it wokrs fine
but with webpack does not

i know what youtube-dl require the child_process,fs,net
and youtube-dl not supporting browser environment
but even if i pass the in package.json

"browser": {
"net": false,
"fs": false,
"child_process":false

},

it otherwise ask about Cannot resolve module
so it dosent reslove my issue

webpack working with modules fs, child_process, net, ?
or it does not?
how can i add child_process,fs,net modules to webpack?
or how can i run youtube-dl out of webpack ?
maybe with shelljs?


ERROR in .//youtube-dl/lib/youtube-dl.js
Module not found: Error: Cannot resolve module 'child_process' in /WebDev/onlyou/node_modules/youtube-dl/lib
@ ./
/youtube-dl/lib/youtube-dl.js 1:16-40

ERROR in .//youtube-dl/lib/youtube-dl.js
Module not found: Error: Cannot resolve module 'fs' in /WebDev/onlyou/node_modules/youtube-dl/lib
@ ./
/youtube-dl/lib/youtube-dl.js 2:16-29

ERROR in .//tough-cookie/lib/cookie.js
Module not found: Error: Cannot resolve module 'net' in /WebDev/onlyou/node_modules/tough-cookie/lib
@ ./
/tough-cookie/lib/cookie.js 32:10-24

@nicksparks nicksparks changed the title Cannot resolve module 'child_process' , 'fs' , 'net' - youtube-dl and webpack Cannot resolve module 'child_process' , 'fs' , 'net' - youtube-dl with webpack Mar 5, 2016
@bebraw bebraw added the question label Mar 6, 2016
@agundermann
Copy link

You can set target: 'node' in your webpack.config file (docs). This should get rid of the node API errors and leave the require calls inside your bundle.

It might be better to just leave the dependencies out of your bundle like you mentioned, since you might run into other problems like dynamic requires. There's a plugin that does this.

@nicksparks
Copy link
Author

Get some error -- "Uncaught ReferenceError: require is not defined"

screen shot 2016-03-11 at 4 05 12 pm

@nicksparks
Copy link
Author

I have found solution like this
http://jlongster.com/Backend-Apps-with-Webpack--Part-II

Thanks @taurose for respond

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants