Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k 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 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...