IonicaBizau / image-to-ascii

:floppy_disk: A Node.js module that converts images to ASCII art.
http://ionicabizau.net/blog/16
MIT License
1.58k stars 105 forks source link

at Socket.<anonymous> /node_modules/gm/lib/command.js:57:17) #42

Closed abdennour closed 7 years ago

abdennour commented 7 years ago

Env 👍

1. OS : OSX 10.11.6 2. Npm: 4.0.1 3. Node 6.2.1

Error 👎

[ Error: Stream yields empty buffer
      at Socket.<anonymous> (/Users/hamma/test-img-console/node_modules/gm/lib/command.js:57:17)
      at emitNone (events.js:91:20)
      at Socket.emit (events.js:185:7)
      at endReadableNT (_stream_readable.js:926:12)
      at _combinedTickCallback (internal/process/next_tick.js:74:11)
      at process._tickCallback (internal/process/next_tick.js:98:9),
  Error: Could not execute GraphicsMagick/ImageMagick: gm "identify" "-ping" "-format" "%wx%h" "-" this most likely means the gm/convert binaries can't be found
      at ChildProcess.<anonymous> (/Users/hamma/test-img-console/nodejs-plugins/console-img/node_modules/gm/lib/command.js:232:12)
      at emitOne (events.js:96:13)
      at ChildProcess.emit (events.js:188:7)
      at Process.ChildProcess._handle.onexit (internal/child_process.js:202:12)
      at onErrorNT (internal/child_process.js:348:16)
      at _combinedTickCallback (internal/process/next_tick.js:74:11)
      at process._tickCallback (internal/process/next_tick.js:98:9) ]
IonicaBizau commented 7 years ago

Is it happening for all the images or for a specific image only? If it's the later, can you please upload the image?

HeroProtagonist commented 7 years ago

Did you install the perquisite?

$ sudo apt-get install graphicsmagick # Ubuntu
$ brew install graphicsmagick         # Mac OS X
m59peacemaker commented 7 years ago

Shouldn't the lwip fallback prevent this?

IonicaBizau commented 7 years ago

@m59peacemaker It should the lwip fallback should prevent the spawn error (ENOENT command not found ..., or so). It's very hard to tell why does this problem appear at all, because we have no example when it fails like that.

The OP seems to have GraphicsMagick already installed.

Did it happen to you as well?

m59peacemaker commented 7 years ago

I did originally get the same error as the OP. I'm not sure whether I had graphicsmagick installed, but I thought I didn't and so went ahead installed it without checking first (oops). The same error remained. I just purged graphicsmagick and reinstalled image-to-ascii globally, now the error is simply error spawn gm ENOENT. I was just checking out the package. I don't have a stake in getting it working, but I hope my notes help.

IonicaBizau commented 7 years ago

@m59peacemaker Thanks for that! I will look into that error when getting a little bit of time. Sounds like lwip is not used...

IonicaBizau commented 7 years ago

I reproduced this error on my machine. I'm on it.

IonicaBizau commented 7 years ago

@m59peacemaker @abdennour For my information—did you receive any errors during the installation?

You can double-check by running rm -rf node_mdoules && npm install

IonicaBizau commented 7 years ago

The installation should fail if lwip fails to be installed.

Addressed in https://github.com/IonicaBizau/lwip2/pull/16.

The reason for the error was: in case gm is not available, lwip is installed (and compiled). In case the required tools for compilation are missing (e.g. XCode or so), lwip installation was failing silently. Now that error should block the image-to-ascii installation. 💥