matheuss / google-translate-api

A free and unlimited API for Google Translate :dollar::no_entry_sign:
https://npmjs.com/package/google-translate-api
MIT License
2.88k stars 605 forks source link

TypeError: fs$ReadStream is undefined #34

Open shebinjoseph388 opened 7 years ago

shebinjoseph388 commented 7 years ago

TypeError: fs$ReadStream is undefined

rdhenderson commented 7 years ago

I'm getting the same error trying to use this module with create-react-app. From what I can tell, its a webpack issue based on how a library is being "required". It can be worked around by ejecting, anyone have a notion on how to resolve without that?

screen shot 2017-09-12 at 3 49 50 pm
bahablgn commented 7 years ago

For the browser support i have used Browserify to convert the code, as a result , the converted file translate.js its about 300 kb and when i use that ı got an error:

Uncaught TypeError: Cannot read property 'prototype' of undefined at patch (translater.js:10974) at Object.<anonymous> (translater.js:10835) at Object.66../fs.js (translater.js:11072) at s (translater.js:1) at translater.js:1 at Object.56.dot-prop (translater.js:9695) at s (translater.js:1) at translater.js:1 at Object.62.configstore (translater.js:10159) at s (translater.js:1)

ssdd

theGABS commented 7 years ago

The same trouble!

Viiinc commented 6 years ago

Same problem here, any update?

Enfernuz commented 6 years ago

It has to do with the configstore module, which is used by the google-translate-token module to store the token. configstore uses graceful-fs module that is not compatible with browserify (see https://stackoverflow.com/a/42012528/2031954). I could get away with a hack that involved editing the source code of google-translate-token to make it use another library for token persistence (I chose data-store). Little change is required (essentially, I had to change only the require line) , but nonetheless it is not a clean solution.

ghost commented 6 years ago

same problem

AyoLaja commented 6 years ago

Facing the same problem, was anyone able to get around it?