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

Error: spawn EPERM and Error: spawn ENOENT

Open aferreira44 opened this issue 8 years ago • 3 comments

I'm trying to convert a markdown file to pdf with the code below of index.js and I'm getting these errors after run node index.js.

The first error below is on my Windows 10 Host Machine, and the second one is on my Ubuntu Guest VirtualBox VM.

Any idea of how to solve this?

index.js

var markdownpdf = require("markdown-pdf"),
    fs = require("fs")

markdownpdf().from("./README.md").to("./curriculo.pdf", function() {
    console.log("Converted to PDF successfully!")
})

Terminal Output Error - Windows Host VM

internal/child_process.js:319
    throw errnoException(err, 'spawn');
    ^

Error: spawn EPERM
    at exports._errnoException (util.js:1018:11)
    at ChildProcess.spawn (internal/child_process.js:319:11)
    at exports.spawn (child_process.js:378:9)
    at Object.exports.execFile (child_process.js:143:15)
    at WriteStream.<anonymous> (C:\Users\User\Documents\localdev\curriculo\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:512:14)
    at afterWrite (_stream_writable.js:386:3)
    at onwrite (_stream_writable.js:376:7)

Terminal Output Error - Ubuntu Guest VM

stream.js:74
      throw er; // Unhandled stream error in pipe.
      ^

Error: spawn /media/sf_localdev/curriculo/node_modules/phantomjs-prebuilt/lib/phantom\bin\phantomjs.exe ENOENT
    at exports._errnoException (util.js:870:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
    at onErrorNT (internal/child_process.js:344:16)
    at nextTickCallbackWith2Args (node.js:441:9)
    at process._tickCallback (node.js:355:17)

aferreira44 avatar Jun 08 '17 07:06 aferreira44

I got the same error as with your Ubuntu Guest VM on Arch with nodejs 8.1 and npm 4.6. I used npm install markdown-pdf to install it and node converter.js to run my converter.

converter.js:

var markdownpdf = require("markdown-pdf")

markdownpdf().from("../notes.md").to("out.pdf", function () {
  console.log("Done");
})

X4mp avatar Jun 12 '17 10:06 X4mp

same issue for any docker image i tried, starting from alpine but ubuntu is also affected

sneerin avatar Aug 19 '18 08:08 sneerin

Same issue here on MacOS Mojave

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

Error: spawn /Users/doug/OneDrive - Realogy/notes/node_modules/phantomjs-prebuilt/lib/phantom\bin\phantomjs.exe ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)

Same code works on Windows. And judging by an attempted spawn of "phantomjs.exe", seems like somehow it's assuming I'm on a windows machine?

dough654 avatar Mar 10 '19 02:03 dough654