0
我已經嘗試了所有能夠在互聯網上找到的東西,但是我無法在我的ubuntu 14.04服務器上使phantomjs工作。phantomjs不能與nodejs工作
這裏是我的NodeJS代碼片段:
phantom.create("--web-security=no", "--ignore-ssl-errors=yes",function(ph) {
return ph.createPage(function(page) {
return page.open(htmlfilepath, function(status) {
page.paperSize = { format: 'A4', orientation: 'portrait', border: '1cm' };
page.render(pdffilepath, function(){
ph.exit();
});
});
});
});
的代碼是我的本地系統(Mac OS X中)上工作的罰款。我使用brew在我的本地系統上安裝了phantomjs。
在我的服務器,我安裝使用phantomjs易於得到,它是給下面的錯誤上運行的代碼:
phantom stderr: Fontconfig warning: ignoring UTF-8: not a valid region tag
而下面的調試跟蹤:
phantom stderr: Fontconfig warning: ignoring UTF-8: not a valid region tag [47/205]
phantom stderr: 2016-07-08T02:12:50 [DEBUG] CookieJar - Created but will not store cookies (use option '--cookies-file=<filename>' to enable persisten cookie storage) [45/205]
phantom stderr: 2016-07-08T02:12:50 [DEBUG] Phantom - execute: Configuration [43/205]
2016-07-08T02:12:50 [DEBUG] 0 objectName : "" [42/205]
2016-07-08T02:12:50 [DEBUG] 1 cookiesFile : "" [41/205]
2016-07-08T02:12:50 [DEBUG] 2 diskCacheEnabled : "false" [40/205]
phantom stderr: 2016-07-08T02:12:50 [DEBUG] 3 maxDiskCacheSize : "-1" [38/205]
2016-07-08T02:12:50 [DEBUG] 4 ignoreSslErrors : "true" [37/205]
2016-07-08T02:12:50 [DEBUG] 5 localToRemoteUrlAccessEnabled : "false" [36/205]
2016-07-08T02:12:50 [DEBUG] 6 outputEncoding : "UTF-8" [35/205]
2016-07-08T02:12:50 [DEBUG] 7 proxyType : "http" [34/205]
2016-07-08T02:12:50 [DEBUG] 8 proxy : ":1080" [33/205]
2016-07-08T02:12:50 [DEBUG] 9 proxyAuth : ":" [32/205]
2016-07-08T02:12:50 [DEBUG] 10 scriptEncoding : "UTF-8" [31/205]
2016-07-08T02:12:50 [DEBUG] 11 webSecurityEnabled : "false" [30/205]
2016-07-08T02:12:50 [DEBUG] 12 offlineStoragePath : "" [29/205]
2016-07-08T02:12:50 [DEBUG] 13 offlineStorageDefaultQuota : "-1" [28/205]
2016-07-08T02:12:50 [DEBUG] 14 printDebugMessages : "true" [27/205]
2016-07-08T02:12:50 [DEBUG] 15 javascriptCanOpenWindows : "true" [26/205]
2016-07-08T02:12:50 [DEBUG] 16 javascriptCanCloseWindows : "true" [25/205]
2016-07-08T02:12:50 [DEBUG] 17 sslProtocol : "sslv3" [24/205]
2016-07-08T02:12:50 [DEBUG] 18 sslCertificatesPath : "" [23/205]
[22/205]
phantom stderr: 2016-07-08T02:12:50 [DEBUG] 19 webdriver : ":" [21/205]
2016-07-08T02:12:50 [DEBUG] 20 webdriverLogFile : "" [20/205]
2016-07-08T02:12:50 [DEBUG] 21 webdriverLogLevel : "INFO" [19/205]
2016-07-08T02:12:50 [DEBUG] 22 webdriverSeleniumGridHub : "" [18/205]
2016-07-08T02:12:50 [DEBUG] Phantom - execute: Script & Arguments [17/205]
2016-07-08T02:12:50 [DEBUG] script: "/home/ubuntu/api/node_modules/phantom/shim.js" [16/205]
2016-07-08T02:12:50 [DEBUG] 0 arg: "57128" [15/205]
2016-07-08T02:12:50 [DEBUG] 1 arg: "127.0.0.1" [14/205]
2016-07-08T02:12:50 [DEBUG] Phantom - execute: Starting normal mode [13/205]
[12/205]
phantom stderr: 2016-07-08T02:12:50 [DEBUG] WebPage - setupFrame "" [11/205]
[10/205]
phantom stderr: 2016-07-08T02:12:50 [DEBUG] FileSystem - _open: ":/modules/fs.js" QMap(("mode", QVariant(QString, "r"))) [9/205]
[8/205]
phantom stderr: 2016-07-08T02:12:50 [DEBUG] FileSystem - _open: ":/modules/system.js" QMap(("mode", QVariant(QString, "r"))) [7/205]
[6/205]
phantom stderr: 2016-07-08T02:12:50 [DEBUG] FileSystem - _open: ":/modules/_coffee-script.js" QMap(("mode", QVariant(QString, "r"))) [5/205]
[4/205]
phantom stderr: 2016-07-08T02:12:50 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/package.json" QMap(("mode", QVariant(QString, "r"))) [3/205]
[2/205]
phantom stderr: 2016-07-08T02:12:50 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/coffee-script.js" QMap(("mode", QVariant(QString, "r"))) [1/205]
[0/205]
phantom stderr: 2016-07-08T02:12:50 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/./lexer.js" QMap(("mode", QVariant(QString, "r")))
phantom stderr: 2016-07-08T02:12:50 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/././rewriter.js" QMap(("mode", QVariant(QString, "r")))
phantom stderr: 2016-07-08T02:12:50 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/././helpers.js" QMap(("mode", QVariant(QString, "r")))
phantom stderr: 2016-07-08T02:12:50 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/./parser.js" QMap(("mode", QVariant(QString, "r")))
phantom stderr: 2016-07-08T02:12:50 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/./helpers.js" QMap(("mode", QVariant(QString, "r")))
phantom stderr: 2016-07-08T02:12:50 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/./nodes.js" QMap(("mode", QVariant(QString, "r")))
phantom stderr: 2016-07-08T02:12:50 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/././scope.js" QMap(("mode", QVariant(QString, "r")))
phantom stderr: 2016-07-08T02:12:50 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/./././helpers.js" QMap(("mode", QVariant(QString, "r")))
phantom stderr: 2016-07-08T02:12:50 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/././lexer.js" QMap(("mode", QVariant(QString, "r")))
phantom stderr: 2016-07-08T02:12:50 [DEBUG] FileSystem - _open: ":/modules/../coffee-script/./lib/coffee-script/./././rewriter.js" QMap(("mode", QVariant(QString, "r")))
phantom stderr: 2016-07-08T02:12:50 [DEBUG] FileSystem - _open: ":/modules/webpage.js" QMap(("mode", QVariant(QString, "r")))
phantom stderr: 2016-07-08T02:12:50 [DEBUG] WebPage - setupFrame "<!--framePath //<!--frame0-->-->"
2016-07-08T02:12:50 [DEBUG] WebPage - updateLoadingProgress: 10
phantom stderr: 2016-07-08T02:12:50 [DEBUG] WebPage - updateLoadingProgress: 11
phantom stderr: 2016-07-08T02:12:50 [DEBUG] Network - Resource request error: 6 ("SSL handshake failed") URL: "https://d1fxtkz8shb9d2.cloudfront.net/sockjs-0.3.min.js"
phantom stderr: 2016-07-08T02:12:50 [DEBUG] WebPage - updateLoadingProgress: 100
phantom stderr: 2016-07-08T02:12:50 [DEBUG] WebPage - setupFrame "<!--framePath //<!--frame1-->-->"
phantom stderr: 2016-07-08T02:12:50 [DEBUG] WebPage - updateLoadingProgress: 10
phantom stderr: 2016-07-08T02:12:50 [DEBUG] WebPage - updateLoadingProgress: 11
phantom stderr: 2016-07-08T02:12:50 [DEBUG] Network - Resource request error: 6 ("SSL handshake failed") URL: "https://d1fxtkz8shb9d2.cloudfront.net/sockjs-0.3.min.js"
phantom stderr: 2016-07-08T02:12:50 [DEBUG] WebPage - updateLoadingProgress: 100
任何有關如何解決這個錯誤的幫助將不勝感激。謝謝。