node.js - phantomjs-pdf 不工作

标签 node.js phantomjs sails.js ubuntu-12.04

我在我的 sailsjs 应用程序中使用 phantomjs-pdf。此代码在我的本地计算机(ubuntu 14.0)中运行良好。但是服务器机器(ubuntu 12.0)导致错误,如下所示

  internal/child_process.js:274                                                                                                                      
      var err = this._handle.spawn(options);                                                                                                           
                                 ^                                                                                                                                                                                                      
    TypeError: Bad argument                                                                                                                            
        at TypeError (native)                                                                                                                          
        at ChildProcess.spawn (internal/child_process.js:274:26)                                                                                       
        at exports.spawn (child_process.js:339:9)                                                                                                      
        at Object.exports.execFile (child_process.js:141:15)                                                                                           
        at /var/www/test/node_modules/phantomjs-pdf/lib/phantomjs-pdf.js:83:16                                                           
        at /var/www/test/node_modules/phantomjs-pdf/node_modules/async/lib/async.js:721:13                                               
        at /var/www/test/node_modules/phantomjs-pdf/node_modules/async/lib/async.js:52:16                                                
        at /var/www/test/node_modules/phantomjs-pdf/node_modules/async/lib/async.js:269:32                                               
        at /var/www/test/node_modules/phantomjs-pdf/node_modules/async/lib/async.js:44:16                                                
        at /var/www/test/node_modules/phantomjs-pdf/node_modules/async/lib/async.js:718:17                                               
        at /var/www/test/node_modules/phantomjs-pdf/node_modules/async/lib/async.js:167:37                                               
        at async.series.paperFormat (/var/www/test/node_modules/phantomjs-pdf/lib/phantomjs-pdf.js:51:70)                                
        at /var/www/test/node_modules/phantomjs-pdf/node_modules/async/lib/async.js:713:13                                               
        at Immediate.iterate [as _onImmediate] (/var/www/test/node_modules/phantomjs-pdf/node_modules/async/lib/async.js:262:13)         
        at processImmediate [as _immediateCallback] (timers.js:371:17)

这是我的错误。任何人都告诉我这是什么问题。帮助我。

最佳答案

卸载所有 NPM 包,然后重新安装 NPM 包。

关于node.js - phantomjs-pdf 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33385623/

相关文章:

javascript - 如何使用不同表中的列数据从其他表中获取数据?

angularjs - 如何在 Angular View 中获取 Node 当前用户

javascript - 在 TypeScript 中声明 JavaScript 扩展函数

javascript - Nodejs 回调与糟糕的工作流程

javascript - Firebase 函数将错误的 key 写入 firebase 数据库

node.js - 你没有安装 'phantomjs'

node.js - 如何将我的 Stack Overflow 声誉添加为 GitHub 上的实时徽章?

javascript - PhantomJS 并单击表单按钮

node.js - 如何循环遍历链接并为 PhantomJS 中的每个站点执行 jQuery javascript

node.js - 将 sails 与 Passport js 一起使用