用过phantomjs 得请教一些问题
发布于 1年前 作者 cxh80301983 1494 次浏览

环境: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.<anonymous> (/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)

请教大侠

回到顶部