markdown-pdf icon indicating copy to clipboard operation
markdown-pdf copied to clipboard

TypeError: Bad argument

Open mdeforge opened this issue 9 years ago • 3 comments

When I do "markdown-pdf -o test.pdf test.md", I get this.

TypeError: Bad argument at TypeError (native) at ChildProcess.spawn (internal/child_process.js:289:26) at exports.spawn (child_process.js:380:9) at Object.exports.execFile (child_process.js:143:15) at WriteStream. (C:\Program Files\nodejs\node_modules\markdown-pdf\index.js:117:22) at emitNone (events.js:91:20) at WriteStream.emit (events.js:185:7) at finishMaybe (_stream_writable.js:515:14) at endWritable (_stream_writable.js:525:3) at WriteStream.Writable.end (_stream_writable.js:490:5)

Granted, I used npmbox to build an offline installer for this. But if I'm missing something, I'd really like to know what. Don't deal with node.js and npm stuff everyday. Any clues would be helpful.

mdeforge avatar Dec 22 '16 20:12 mdeforge

I installed markdown-pdf by first installing NPM via the Mac OS package on their website, and then simply running

npm install markdown-pdf

I also get a similar error:

(node:74342) Warning: Possible EventEmitter memory leak detected. 2 end listeners added. Use emitter.setMaxListeners() to increase limit
internal/child_process.js:289
  var err = this._handle.spawn(options);
                         ^

TypeError: Bad argument
    at TypeError (native)
    at ChildProcess.spawn (internal/child_process.js:289:26)
    at exports.spawn (child_process.js:380:9)
    at Object.exports.execFile (child_process.js:143:15)
    at WriteStream.<anonymous> (/Users/daibane/src/omega_h/doc/node_modules/markdown-pdf/index.js:117:22)
    at emitNone (events.js:91:20)
    at WriteStream.emit (events.js:185:7)
    at finishMaybe (_stream_writable.js:515:14)
    at afterWrite (_stream_writable.js:389:3)
    at onwrite (_stream_writable.js:379:7)

ibaned avatar Mar 01 '17 17:03 ibaned

Having trouble reproducing this. This works for me:

$ uname
Linux
$ node --version
v7.10.0
$ cd $(mktemp --dir)
$ npm i markdown-pdf
[ ... npm output ... ]
$ ./node_modules/.bin/markdown-pdf -o test.pdf <(echo '# hi')
[ ... markdown-pdf output ... ]

@mdeforge Are you also on Mac OS?

anko avatar May 16 '17 20:05 anko

Hey folks, I met the same trouble on MacOS, and I find this

markdown-pdf requires phantomjs-prebuilt https://github.com/Medium/phantomjs/issues/533

And it works for me

renhongxu123 avatar May 23 '17 07:05 renhongxu123