Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

node.js - Error: spawn EPERM and Error: spawn ENOENT

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

The first error I got 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? Anything related with phantomjs package?

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:UsersUserDocumentslocaldevcurriculo
ode_modulesmarkdown-pdfindex.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 penter code hereipe.
^

Error: spawn /media/sf_localdev/curriculo/node_modules/phantomjs-prebuilt/lib/phantominphantomjs.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)
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...