epubjs-rn icon indicating copy to clipboard operation
epubjs-rn copied to clipboard

Unhandled promise rejection

Open oakcreations opened this issue 6 years ago • 9 comments

Sometimes this error happens when i'm opening an epub.

screen shot 2018-09-14 at 18 30 38

Error: bind failed: EACCES (Permission denied) at createErrorFromErrorData (blob:http://localhost:8081/29ce852d-6258-406b-a198-eb6e7e1ec87a:sourcemap:2041) at blob:http://localhost:8081/29ce852d-6258-406b-a198-eb6e7e1ec87a:sourcemap:1993 at MessageQueue.__invokeCallback (blob:http://localhost:8081/29ce852d-6258-406b-a198-eb6e7e1ec87a:sourcemap:2435) at blob:http://localhost:8081/29ce852d-6258-406b-a198-eb6e7e1ec87a:sourcemap:2180 at MessageQueue.__guardSafe (blob:http://localhost:8081/29ce852d-6258-406b-a198-eb6e7e1ec87a:sourcemap:2348) at MessageQueue.invokeCallbackAndReturnFlushedQueue (blob:http://localhost:8081/29ce852d-6258-406b-a198-eb6e7e1ec87a:sourcemap:2179) at debuggerWorker.js:70

oakcreations avatar Sep 14 '18 21:09 oakcreations

+1

quy1403 avatar Oct 01 '18 02:10 quy1403

+1

yumikohey avatar Nov 07 '18 23:11 yumikohey

Facing the same issue. Any solutions ?

NigolBista avatar Sep 26 '19 19:09 NigolBista

same issue here. Any solution?

ashokkumar88 avatar Oct 12 '19 08:10 ashokkumar88

@yumikohey did you find any solution?

ashokkumar88 avatar Oct 12 '19 08:10 ashokkumar88

+1

kelflame2610 avatar Oct 20 '19 17:10 kelflame2610

Any Solution ?

NigolBista avatar Oct 23 '19 21:10 NigolBista

The issue here is in the Streamer.js "\node_modules\epubjs-rn\components\Streamer.js" You might need to unminify Streamer.js first.

To do so you can use sites like unminify.com

Here, the localhost port is randomly generated like this this.port = opts.port || "3" + Math.round(Math.random() * 1000);

The value of Math.random() is anywhere between 0 and 1 (inclusive of 0, but not 1) So it works fine most of the time but sometimes when the Math.random() generates value like 0.05, then "this.port" value becomes below 1024. (Ports below 1024 are privilege ports and its not allowed) thus EACCESS Fails. To prevent this you can do something like this

var randPort = 0; do { randPort = Math.round(Math.random() * 1000); } while (randPort < 100) this.port = opts.port || "3" + randPort;

NigolBista avatar Oct 25 '19 22:10 NigolBista

@Nigol496 The solution is working fine. Though we do not need to minify and modify the Streamer.js file. We can do it in the component also and pass the port number as a param to the Steamer class. Like below

``var randPort = 0; do { randPort = Math.round(Math.random() * 1000); } while (randPort < 100) port = "3" + randPort;

this.streamer = new Streamer({port:port});``

ashokkumar88 avatar Oct 29 '19 05:10 ashokkumar88