samt/barcode

Not writing any data

computersarecool opened this issue · 4 comments

Hi,

I am trying the example exactly as it is documented but none of my files receive any data (they are written with 0 bytes). For example:

var barcode = require('barcode');
var outfile = 'done.png';

var code39 = barcode('code39', {
  data: "it works",
  width: 400,
  height: 100,
});

code39.saveImage(outfile, function (err) {
  if (err) throw err;
  console.log('File has been written!');
});

Says "File has been written" but there is no data there. The same is true with the other examples (piping for example).

samt commented

Can you run this command in the terminal or command prompt and post the output here?

gm -version

I got this when copy/pasting the exact code you posted:

done

dyld: Library not loaded: /usr/local/lib/libfreetype.6.dylib
  Referenced from: /usr/local/bin/gm
  Reason: Incompatible library version: gm requires version 18.0.0 or later, but libfreetype.6.dylib provides version 16.0.0
Trace/BPT trap: 5
samt commented

It looks like the GraphicMagick install went bad or is out of date. If you're on a mac, I would recommend updating graphicsmagick:

brew update && brew upgrade

And try running your js again.

Got it. You were right, I did a bunch of weird symlinking and it works now. Thanks for the help and this project.