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

internal/validators.js:120

Open jcguu95 opened this issue 5 years ago • 1 comments

markdown-pdf "advanced_shell.md" gives the following error.

internal/validators.js: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 validateString (internal/validators.js:120: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/lib/node_modules/markdown-pdf/index.js:117:22)
    at WriteStream.emit (events.js:327:22)
    at finishMaybe (_stream_writable.js:653:14)
    at _stream_writable.js:627:7
    at WriteStream._final (internal/fs/streams.js:379:3)
    at callFinal (_stream_writable.js:620:10) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Seemingly related to https://github.com/alanshaw/markdown-pdf/issues/181. Tried the solution there. But which phantomjs gives phantomjs not found.

jcguu95 avatar Apr 22 '20 01:04 jcguu95

You can install phantomjs by using sudo npm install -g phantomjs-prebuilt --ignore-scripts however, then the following error occurs when calling markdown-pdf -p $(which phantomjs) mymarkdown.md:

internal/streams/legacy.js:61
      throw er; // Unhandled stream error in pipe.
      ^

Error: Command failed: /usr/bin/phantomjs /usr/lib/node_modules/markdown-pdf/phantom/render.js /tmp/tmp-5628H7jFMrbRDbsX.html /tmp/tmp-5628bFVRo3gGNPcE.pdf /home/<uname>/Documents/ProjectReflection /usr/lib/node_modules/markdown-pdf/runnings.js /usr/lib/node_modules/markdown-pdf/css/pdf.css /usr/lib/node_modules/markdown-pdf/css/highlight.css A4 portrait 2cm 0 10000
internal/validators.js:121
    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:121:11)
    at normalizeSpawnArguments (child_process.js:406:3)
    at spawn (child_process.js:546:13)
    at Object.<anonymous> (/usr/lib/node_modules/phantomjs-prebuilt/bin/phantomjs:22:10)
    at Module._compile (internal/modules/cjs/loader.js:1176:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1196:10)
    at Module.load (internal/modules/cjs/loader.js:1040:32)
    at Function.Module._load (internal/modules/cjs/loader.js:929:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'ERR_INVALID_ARG_TYPE'
}

    at ChildProcess.exithandler (child_process.js:303:12)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1051:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5) {
  killed: false,
  code: 1,
  signal: null,
  cmd: '/usr/bin/phantomjs /usr/lib/node_modules/markdown-pdf/phantom/render.js /tmp/tmp-5628H7jFMrbRDbsX.html /tmp/tmp-5628bFVRo3gGNPcE.pdf /home/<uname>/Documents/ProjectReflection /usr/lib/node_modules/markdown-pdf/runnings.js /usr/lib/node_modules/markdown-pdf/css/pdf.css /usr/lib/node_modules/markdown-pdf/css/highlight.css A4 portrait 2cm 0 10000'
}

HenriBDB avatar May 10 '20 10:05 HenriBDB