使用 wkhtmltopdf 时出错

ton*_*227 1 node.js wkhtmltopdf

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

我的代码:

var wkhtmltopdf = require('wkhtmltopdf');

wkhtmltopdf('http://google.com/', { pageSize: 'letter' }).pipe(fs.createWriteStream('/out.pdf'));
Run Code Online (Sandbox Code Playgroud)

我的错误:

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
Run Code Online (Sandbox Code Playgroud)

Mic*_*mel 5

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

然后确保该bin文件夹位于您的 PATH 中。C:\Program Files\wkhtmltopdf\bin是默认安装路径。验证它是否适合您的机器。