electricbookworks/electric-book

"Stream yields empty buffer" error when converting images

jaycolmvar opened this issue · 1 comments

I'm doing a "convert source images" operation (my first in a while) and am getting an error "Stream yields empty buffer" when running option 7, "Convert source images to output formats". Note that my repository is up to date with respect to the electric-books HEAD, and that I've run "Install or update dependencies" as well.

The complete output from the run is below. There is a single updated file that needs to be converted, in book/images/_source/cover.jpg.

Do you all have any idea what this error might be? I'm going to try to debug it further, but if you've seen anything like this before it would be good to have an idea of where to look.

========================

./run-linux.sh

Electric Book options

1 Create a print PDF
2 Create a screen PDF
3 Run as a website
4 Create an epub
5 Create an app
6 Export to Word
7 Convert source images to output formats
8 Refresh search and book-index databases
9 Install or update dependencies
x Exit

Enter a number and hit enter. 7
Let's convert your source images.
This process will optimise the images in a book's _source folder
and copy them to the print-pdf, screen-pdf, web and epub image folders.
You need to have run 'Install or update dependencies' at least once,
have Gulp installed globally (https://gulpjs.com/),
and have GraphicsMagick installed (http://www.graphicsmagick.org, or try
brew install graphicsmagick
Which book's images are you converting? Hit enter for the default 'book'.

Are we converting books in a translation? If not, hit enter.
Otherwise, enter the language code/translation directory name.

If processing images for a book that's not in the /book directory, use the --book argument, e.g. gulp --book potatoes
To process images in assets, use gulp --folder assets
If processing a translation's images, use the --language argument, e.g. gulp --language fr
If processing for a specific output, use the --output argument, e.g. gulp --output printpdf. No hyphens.
[22:38:04] Using gulpfile ~/src/rsbf-wip/gulpfile.js
[22:38:04] Starting 'default'...
[22:38:04] Starting 'images:svg'...
Processing SVG images from book/images/_source/
[22:38:04] Finished 'images:svg' after 131 ms
[22:38:04] Starting 'images:printpdf'...
Processing print-pdf images from book/images/_source/
[22:38:04] Finished 'images:printpdf' after 9.67 ms
[22:38:04] Starting 'images:screenpdf'...
Processing screen-pdf images from book/images/_source/
[22:38:04] Finished 'images:screenpdf' after 5.2 ms
[22:38:04] Starting 'images:epub'...
Processing epub images from book/images/_source/
[22:38:04] Finished 'images:epub' after 2.63 ms
[22:38:04] Starting 'images:app'...
Processing app images from book/images/_source/
[22:38:04] Finished 'images:app' after 8.01 ms
[22:38:04] Starting 'images:web'...
Processing web images from book/images/_source/
[22:38:04] Finished 'images:web' after 2.87 ms
[22:38:04] Starting 'images:small'...
Creating small web images from book/images/_source/
[22:38:04] Finished 'images:small' after 2.75 ms
[22:38:04] Starting 'images:medium'...
Creating medium web images from book/images/_source/
[22:38:04] Finished 'images:medium' after 2.51 ms
[22:38:04] Starting 'images:large'...
Creating large web images from book/images/_source/
[22:38:04] Finished 'images:large' after 2.62 ms
[22:38:04] Starting 'images:xlarge'...
Creating extra-large web images from book/images/_source/
[22:38:04] Finished 'images:xlarge' after 3.01 ms
[22:38:04] Starting 'images:max'...
Creating max-quality web images from book/images/_source/
[22:38:04] Finished 'images:max' after 9.11 ms
[22:38:04] Finished 'default' after 207 ms
[22:38:04] Processing SVG 0 items
[22:38:04] Creating print-pdf version of book/images/_source/cover.jpg
[22:38:04] Creating screen-pdf version of book/images/_source/cover.jpg
[22:38:04] Creating epub version of book/images/_source/cover.jpg
[22:38:04] Creating app version of book/images/_source/cover.jpg
[22:38:04] Creating web version of book/images/_source/cover.jpg
[22:38:04] Creating web version of book/images/_source/cover.jpg
[22:38:04] Creating web version of book/images/_source/cover.jpg
[22:38:04] Creating web version of book/images/_source/cover.jpg
[22:38:04] Creating web version of book/images/_source/cover.jpg
[22:38:04] Creating web version of book/images/_source/cover.jpg
{ Error: Stream yields empty buffer
at Socket. (/home/jaycolmvar/src/rsbf-wip/node_modules/gm/lib/command.js:57:17)
at Socket.emit (events.js:203:15)
at Socket.EventEmitter.emit (domain.js:466:23)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
message: 'Stream yields empty buffer',
name: 'Error',
stack:
'Error: Stream yields empty buffer\n at Socket. (/home/jaycolmvar/src/rsbf-wip/node_modules/gm/lib/command.js:57:17)\n at Socket.emit (events.js:203:15)\n at Socket.EventEmitter.emit (domain.js:466:23)\n at endReadableNT (_stream_readable.js:1145:12)\n at process._tickCallback (internal/process/next_tick.js:63:19)',
__safety: undefined,
_stack: undefined,
plugin: 'gulp-gm',
showProperties: true,
showStack: false }
{ Error: Stream yields empty buffer
at Socket. (/home/jaycolmvar/src/rsbf-wip/node_modules/gm/lib/command.js:57:17)
at Socket.emit (events.js:203:15)
at Socket.EventEmitter.emit (domain.js:466:23)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
message: 'Stream yields empty buffer',
name: 'Error',
stack:
'Error: Stream yields empty buffer\n at Socket. (/home/jaycolmvar/src/rsbf-wip/node_modules/gm/lib/command.js:57:17)\n at Socket.emit (events.js:203:15)\n at Socket.EventEmitter.emit (domain.js:466:23)\n at endReadableNT (_stream_readable.js:1145:12)\n at process._tickCallback (internal/process/next_tick.js:63:19)',
__safety: undefined,
_stack: undefined,
plugin: 'gulp-gm',
showProperties: true,
showStack: false }
{ Error: Stream yields empty buffer
at Socket. (/home/jaycolmvar/src/rsbf-wip/node_modules/gm/lib/command.js:57:17)
at Socket.emit (events.js:203:15)
at Socket.EventEmitter.emit (domain.js:466:23)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
message: 'Stream yields empty buffer',
name: 'Error',
stack:
'Error: Stream yields empty buffer\n at Socket. (/home/jaycolmvar/src/rsbf-wip/node_modules/gm/lib/command.js:57:17)\n at Socket.emit (events.js:203:15)\n at Socket.EventEmitter.emit (domain.js:466:23)\n at endReadableNT (_stream_readable.js:1145:12)\n at process._tickCallback (internal/process/next_tick.js:63:19)',
__safety: undefined,
_stack: undefined,
plugin: 'gulp-gm',
showProperties: true,
showStack: false }
{ Error: Stream yields empty buffer
at Socket. (/home/jaycolmvar/src/rsbf-wip/node_modules/gm/lib/command.js:57:17)
at Socket.emit (events.js:203:15)
at Socket.EventEmitter.emit (domain.js:466:23)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
message: 'Stream yields empty buffer',
name: 'Error',
stack:
'Error: Stream yields empty buffer\n at Socket. (/home/jaycolmvar/src/rsbf-wip/node_modules/gm/lib/command.js:57:17)\n at Socket.emit (events.js:203:15)\n at Socket.EventEmitter.emit (domain.js:466:23)\n at endReadableNT (_stream_readable.js:1145:12)\n at process._tickCallback (internal/process/next_tick.js:63:19)',
__safety: undefined,
_stack: undefined,
plugin: 'gulp-gm',
showProperties: true,
showStack: false }
{ Error: Stream yields empty buffer
at Socket. (/home/jaycolmvar/src/rsbf-wip/node_modules/gm/lib/command.js:57:17)
at Socket.emit (events.js:203:15)
at Socket.EventEmitter.emit (domain.js:466:23)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
message: 'Stream yields empty buffer',
name: 'Error',
stack:
'Error: Stream yields empty buffer\n at Socket. (/home/jaycolmvar/src/rsbf-wip/node_modules/gm/lib/command.js:57:17)\n at Socket.emit (events.js:203:15)\n at Socket.EventEmitter.emit (domain.js:466:23)\n at endReadableNT (_stream_readable.js:1145:12)\n at process._tickCallback (internal/process/next_tick.js:63:19)',
__safety: undefined,
_stack: undefined,
plugin: 'gulp-gm',
showProperties: true,
showStack: false }
{ Error: Stream yields empty buffer
at Socket. (/home/jaycolmvar/src/rsbf-wip/node_modules/gm/lib/command.js:57:17)
at Socket.emit (events.js:203:15)
at Socket.EventEmitter.emit (domain.js:466:23)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
message: 'Stream yields empty buffer',
name: 'Error',
stack:
'Error: Stream yields empty buffer\n at Socket. (/home/jaycolmvar/src/rsbf-wip/node_modules/gm/lib/command.js:57:17)\n at Socket.emit (events.js:203:15)\n at Socket.EventEmitter.emit (domain.js:466:23)\n at endReadableNT (_stream_readable.js:1145:12)\n at process._tickCallback (internal/process/next_tick.js:63:19)',
__safety: undefined,
_stack: undefined,
plugin: 'gulp-gm',
showProperties: true,
showStack: false }
{ Error: Stream yields empty buffer
at Socket. (/home/jaycolmvar/src/rsbf-wip/node_modules/gm/lib/command.js:57:17)
at Socket.emit (events.js:203:15)
at Socket.EventEmitter.emit (domain.js:466:23)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
message: 'Stream yields empty buffer',
name: 'Error',
stack:
'Error: Stream yields empty buffer\n at Socket. (/home/jaycolmvar/src/rsbf-wip/node_modules/gm/lib/command.js:57:17)\n at Socket.emit (events.js:203:15)\n at Socket.EventEmitter.emit (domain.js:466:23)\n at endReadableNT (_stream_readable.js:1145:12)\n at process._tickCallback (internal/process/next_tick.js:63:19)',
__safety: undefined,
_stack: undefined,
plugin: 'gulp-gm',
showProperties: true,
showStack: false }
{ Error: Stream yields empty buffer
at Socket. (/home/jaycolmvar/src/rsbf-wip/node_modules/gm/lib/command.js:57:17)
at Socket.emit (events.js:203:15)
at Socket.EventEmitter.emit (domain.js:466:23)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
message: 'Stream yields empty buffer',
name: 'Error',
stack:
'Error: Stream yields empty buffer\n at Socket. (/home/jaycolmvar/src/rsbf-wip/node_modules/gm/lib/command.js:57:17)\n at Socket.emit (events.js:203:15)\n at Socket.EventEmitter.emit (domain.js:466:23)\n at endReadableNT (_stream_readable.js:1145:12)\n at process._tickCallback (internal/process/next_tick.js:63:19)',
__safety: undefined,
_stack: undefined,
plugin: 'gulp-gm',
showProperties: true,
showStack: false }
{ Error: Stream yields empty buffer
at Socket. (/home/jaycolmvar/src/rsbf-wip/node_modules/gm/lib/command.js:57:17)
at Socket.emit (events.js:203:15)
at Socket.EventEmitter.emit (domain.js:466:23)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
message: 'Stream yields empty buffer',
name: 'Error',
stack:
'Error: Stream yields empty buffer\n at Socket. (/home/jaycolmvar/src/rsbf-wip/node_modules/gm/lib/command.js:57:17)\n at Socket.emit (events.js:203:15)\n at Socket.EventEmitter.emit (domain.js:466:23)\n at endReadableNT (_stream_readable.js:1145:12)\n at process._tickCallback (internal/process/next_tick.js:63:19)',
__safety: undefined,
_stack: undefined,
plugin: 'gulp-gm',
showProperties: true,
showStack: false }
{ Error: Stream yields empty buffer
at Socket. (/home/jaycolmvar/src/rsbf-wip/node_modules/gm/lib/command.js:57:17)
at Socket.emit (events.js:203:15)
at Socket.EventEmitter.emit (domain.js:466:23)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
message: 'Stream yields empty buffer',
name: 'Error',
stack:
'Error: Stream yields empty buffer\n at Socket. (/home/jaycolmvar/src/rsbf-wip/node_modules/gm/lib/command.js:57:17)\n at Socket.emit (events.js:203:15)\n at Socket.EventEmitter.emit (domain.js:466:23)\n at endReadableNT (_stream_readable.js:1145:12)\n at process._tickCallback (internal/process/next_tick.js:63:19)',
__safety: undefined,
_stack: undefined,
plugin: 'gulp-gm',
showProperties: true,
showStack: false }
[22:38:09] Creating print-pdf version of 1 item
[22:38:09] Creating screen-pdf version of 1 item
[22:38:09] Creating epub version of 1 item
[22:38:09] Creating app version of 1 item
[22:38:09] Creating web version of 1 item
[22:38:09] Creating web version of 1 item
[22:38:09] Creating web version of 1 item
[22:38:09] Creating web version of 1 item
[22:38:09] Creating web version of 1 item
[22:38:09] Creating web version of 1 item
Enter to run again, or any other key and enter to stop.
x

Electric Book options

1 Create a print PDF
2 Create a screen PDF
3 Run as a website
4 Create an epub
5 Create an app
6 Export to Word
7 Convert source images to output formats
8 Refresh search and book-index databases
9 Install or update dependencies
x Exit

Enter a number and hit enter. x

Well that was embarrassing: After doing a fresh install of EBW onto a clean Ubuntu installation and generating the sample book, the problem went away. And then I checked out the new cover.jpg I had put in, and discovered that it was zero bytes long. I had inadvertently copied the wrong file. Once I put in the correct cover.jpg the problem went away.

So the error message was correct: there was nothing in the image file, so the stream read in gulp returned an empty buffer.