あいまいなエラー ENOENT が発生しています。これが出力です。
converting SVG to a PNG
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)
これがコードです。print ステートメントを調べると、 への呼び出しの直前に発生しているようchild.spawn
です。
child = require 'child_process'
svgToPNG = (svg, reply, log) ->
# set up a child process to call convert svg: png:-
log "converting SVG to a PNG"
convert = child.spawn 'convert', ['svg:', 'png:-']
convert.stderr.on 'data', (data) ->
log data.toString()
convert.stdout.end data
return reply "error occurred"
# create buffer that output will be piped into
res = ""
# pipe this process' stdout into res
convert.stdout.pipe res
# pipe svg into the process and close its input, startin the process
convert.stdin.end svg
# call reply with the res as content
log "OK done converting to a PNG, replying"
reply res
コマンドラインからの呼び出しconvert
は問題なく機能します。なぜこれが失敗するのかわかりません。