CNode

用过phantomjs 得请教一些问题

Ccxh80301983发布于12 年前最后回复12 年前0 回复6747 浏览0 收藏

环境:linux 64 从官网下载了 phantomjs 并复制到 /usr/bin目录 切 也按照了 github 上 npm install phantom // phantomjs 桥; 服务环境: expressjs

代码片段 app.get('/pdf',function(req,res){ var phantom = require('phantom'); console.log(phantom); phantom.create(function(ph){ console.log(ph); res.end(); }) })

报错代码片段: { create: [Function], stderrHandler: [Function] } phantom stderr: phantomjs: error while loading shared libraries: libfreetype.so.6: cannot open shared object file: No such file or directory

assert.js:92 throw new assert.AssertionError({ ^ AssertionError: abnormal phantomjs exit code: 127 at Console.assert (console.js:102:23) at ChildProcess. (/home/wwwroot/mysite/node_modules/phantom/phantom.js:129:28) at ChildProcess.EventEmitter.emit (events.js:98:17) at Process.ChildProcess._handle.onexit (child_process.js:789:12)

成功得代码片段: { create: [Function], stderrHandler: [Function] } { set: [Function], get: [Function], exit: [Function], injectJs: [Function], getCookies: [Function], addCookie: [Function], clearCookies: [Function], createPage: [Function], _createPage: [Function] } GET /pdf 200 1460ms

同样得代码 本地没问题 (本地mac os)

请教大侠

查看回复

回复 (0)

暂无回复,成为第一个参与讨论的人。
参与回复
登录后即可参与回复。登录