Search code examples
highchartsphantomjsexport

How to set the url of moment.min.js to local js file when highcharts exporting png file


When I am using 'highcharts-export-server' as local service module in node.js to rendering and exporting images, I got these error message after 7 hours:

Tue Mar 19 2019 13:31:33 GMT+0800 (China Standard Time) [error] 
phantom worker 631 error - worker.js resource error - {
    "errorCode": 3,
    "errorString": "Host cdnjs.cloudflare.com not found",
    "id": 2,
    "status": null,
    "statusText": null,
    "url": "https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.13/moment-timezone-with-data-2012-2022.min.js"
}
Tue Mar 19 2019 13:31:33 GMT+0800 (China Standard Time) [error] 
phantom worker "Host cdnjs.cloudflare.com not found",
    "id": 1,
    "status": null,
    "statusText": null,
    "url": "https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"
}

I think the phantom worker was trying download js files from the external server but failed, so I want to save these js files to local disk and the phantom worker do know download each time.

How to solve this problem?

Thank a lot!


Solution

  • Since version 2.0.9, in highcharts-export-server you can enable moment.js by running npm install interactively, or by setting the environment variable HIGHCHARTS_MOMENT to 1.

    Related issue: https://github.com/highcharts/node-export-server/issues/119