alanshaw/markdown-pdf

internal/validators.js:118

isomorphisms opened this issue · 3 comments

    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received null
    at validateString (internal/validators.js:118:11)
    at normalizeSpawnArguments (child_process.js:406:3)
    at spawn (child_process.js:546:13)
    at Object.execFile (child_process.js:232:17)
    at WriteStream.<anonymous> (/usr/local/lib/node_modules/markdown-pdf/index.js:117:22)
    at WriteStream.emit (events.js:333:22)
    at finishMaybe (_stream_writable.js:697:14)
    at _stream_writable.js:673:7
    at WriteStream._final (internal/fs/streams.js:377:3)
    at callFinal (_stream_writable.js:666:10) {
  code: 'ERR_INVALID_ARG_TYPE'
}```

It seems that you have to specify the path to phantomjs binary. markdown-pdf -p $(which phantomjs) mymarkdown.md

I have the same issue.
I have installed phantomjs using npm as follows:
npm install phantomjs -g
It has been installed at /usr/local/bin/phantomjs

What is the path expected by phantomjs module to avoid specifying its path as markdown-pdf option?

I've realized that phantomjs npm package is deprecated. After uninstalling it and installing globally phantomjs-prebuilt the issue has been fixed.