使用wkhtmltopdf时出错

我使用wkhtmltopdf时遇到了一个问题,我刚刚安装了64位版本和nodejs依赖项,但出现错误:

我的代码:

var wkhtmltopdf = require('wkhtmltopdf'); wkhtmltopdf('http://google.com/', { pageSize: 'letter' }).pipe(fs.createWriteStream('/out.pdf')); 

我的错误:

 events.js:72 throw er; // Unhandled 'error' event ^ Error: spawn ENOENT at errnoException (child_process.js:1001:11) at Process.ChildProcess._handle.onexit (child_process.js:792:34) npm ERR! GestionDettes@1.2.0 start: `node ./bin/www` npm ERR! Exit status 8 npm ERR! npm ERR! Failed at the *******@1.2.0 start script. npm ERR! This is most likely a problem with the GestionDettes package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node ./bin/www npm ERR! You can get their info via: npm ERR! npm owner ls GestionDettes npm ERR! There is likely additional logging output above. npm ERR! System Windows_NT 6.2.9200 npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start" npm ERR! cwd C:\xampp\htdocs\******* npm ERR! node -v v0.10.33 npm ERR! npm -v 1.4.28 npm ERR! code ELIFECYCLE npm ERR! npm ERR! Additional logging details can be found in: npm ERR! C:\xampp\htdocs\********\npm-debug.log npm ERR! not ok code 0 

确保已经安装了wkhtmltopdf命令行工具。 你可以从http://wkhtmltopdf.org/downloads.html下载

然后确保bin文件夹在PATH上。 C:\Program Files\wkhtmltopdf\bin是默认的安装path。 确认您的机器是否正确。