question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received null

See original GitHub issue

here was my command:

markdown-pdf report-paper-3.md -o $(uuidgen)

I got this error

node:internal/validators:120
    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 new NodeError (node:internal/errors:372:5)
    at validateString (node:internal/validators:120:11)
    at normalizeSpawnArguments (node:child_process:505:3)
    at spawn (node:child_process:693:13)
    at Object.execFile (node:child_process:327:17)
    at WriteStream.<anonymous> (/Users/amills/.nvm/versions/node/v16.15.0/lib/node_modules/markdown-pdf/index.js:117:22)
    at WriteStream.emit (node:events:539:35)
    at finish (node:internal/streams/writable:754:10)
    at finishMaybe (node:internal/streams/writable:739:9)
    at afterWrite (node:internal/streams/writable:504:3) {
  code: 'ERR_INVALID_ARG_TYPE'
}

the error makes no sense to me 😦 😦

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:8
  • Comments:7

github_iconTop GitHub Comments

1reaction
ronaldbosmacommented, Oct 22, 2022

It worked for me after installing phantomjs-prebuilt and passing the path to the phantomjs.exe as the --phantom-path parameter.

Example:

markdown-pdf my-file.md --out my-file.pdf --phantom-path ...\node_modules\phantomjs-prebuilt\lib\phantom\bin\phantomjs.exe
0reactions
lucastheisencommented, Dec 10, 2022

I had to supply both:

OPENSSL_CONF=/etc/ssl markdown-pdf \
  --phantom-path "${NODE_MODULES_DIR}/phantomjs-prebuilt/lib/phantom/bin/phantomjs" \
  --out test.pdf
  README.md
Read more comments on GitHub >

github_iconTop Results From Across the Web

The "path" argument must be of type string ... - Stack Overflow
I'm working on a project in React and ran into a problem that has me stumped. Whenever I run yarn start I get...
Read more >
The "file" argument must be of type string. Received type object
Hi, When I run markdown-pdf README.md I get the following error: throw new ERR_INVALID_ARG_TYPE(name, 'string', value); ^ TypeError [ERR_INVALID_ARG_TYPE]: ...
Read more >
[Fix] TypeError [ERR_INVALID_ARG_TYPE]: The “path ...
Have you run into the error “TypeError [ERR_INVALID_ARG_TYPE]: The “path” argument must be of type string. Received undefined”? In this story I'll go...
Read more >
The "path" argument must be of type string. Received - YouTube
JavaScript : TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined raised when starting ...
Read more >
the key argument must be of type string or an instance of ...
TypeError [ERRINVALIDARGTYPE]: The "key" argument must be of type string or an instance of Buffer, TypedArray, DataView, or KeyObject. Received null at ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found