highcharts / node-export-server

Highcharts Node.js export server
Other
354 stars 260 forks source link

Export server crashes with message `ReferenceError: Can't find variable: Intl` #284

Closed markuspalme closed 1 year ago

markuspalme commented 3 years ago

Expected behaviour

After installing highcharts-export-server 2.1.0 with default options charts can be exported.

Actual behaviour

The export server crashes with an error message.

grafik

Reproduction steps

Install:

npm install highcharts-export-server -g

Agree to the license terms? y/n:  (no) y
Select your Highcharts version (e.g. 4.2.2)::  (latest)
Include Maps? (requires Maps license):  (no)
Include Gantt? (requires Gantt license, and >V6.2):  (no)
Enable styled mode? (requires Highcharts/Highstock 5+ license):  (no)
Include moment.js for date/time handling?:  (no)
Which CDN would you like to use?:  (https://code.highcharts.com/)
Enable wordcloud support? y/n:  (no)
Enable annotations support? y/n:  (no)

Test export:

highcharts-export-server -infile basic.json -outfile chart.png -allowCodeExecution true

Full error message:

    __  ___       __         __               __
   / / / (_)___ _/ /_  _____/ /_  ____ ______/ /______
  / /_/ / / __ `/ __ \/ ___/ __ \/ __ `/ ___/ __/ ___/
 / __  / / /_/ / / / / /__/ / / / /_/ / /  / /_(__  )
/_/ /_/_/\__, /_/ /_/\___/_/ /_/\__,_/_/   \__/____/
        ____//___/                  __     _____
       / ____/  ______  ____  _____/ /_   / ___/___  ______   _____  _____
      / __/ | |/_/ __ \/ __ \/ ___/ __/   \__ \/ _ \/ ___/ | / / _ \/ ___/
     / /____>  </ /_/ / /_/ / /  / /_    ___/ /  __/ /   | |/ /  __/ /
    /_____/_/|_/ .___/\____/_/   \__/   /____/\___/_/    |___/\___/_/
              /_/

                                                                  v2.1.0
Tue Jun 08 2021 12:42:35 GMT+0200 (GMT+02:00) [error] phantom worker 1 unexpected data - ReferenceError: Can't find variable: Intl

  undefined:108
  :83 in P
  :108
  :83
{"filename":"chart.png"} {
  data: {
    allowCodeExecution: false,
    width: false,
    callback: false,
    resources: false,
    scale: 1,
    constr: 'Chart',
    chart: {
      xAxis: [Object],
      series: [Array],
      chart: [Object],
      exporting: [Object]
    },
    svgstr: undefined,
    format: 'png',
    out: 'chart.png',
    styledMode: false,
    asyncRendering: undefined,
    async: true,
    reqID: '',
    globalOptions: false,
    themeOptions: false,
    customCode: false,
    dataOptions: false,
    id: 1
  },
  working: true,
  ready: false,
  alive: true,
  process: ChildProcess {
    _events: [Object: null prototype] {
      uncaughtException: [Function],
      error: [Function],
      close: [Function]
    },
    _eventsCount: 3,
    _maxListeners: undefined,
    _closesNeeded: 3,
    _closesGot: 0,
    connected: false,
    signalCode: null,
    exitCode: null,
    killed: false,
    spawnfile: 'C:\\Users\\Markus\\AppData\\Roaming\\npm\\node_modules\\highcharts-export-server\\node_modules\\phantomjs-prebuilt\\lib\\phantom\\bin\\phantomjs.exe',
    _handle: Process {
      onexit: [Function],
      pid: 28908,
      [Symbol(owner_symbol)]: [Circular]
    },
    spawnargs: [
      'C:\\Users\\Markus\\AppData\\Roaming\\npm\\node_modules\\highcharts-export-server\\node_modules\\phantomjs-prebuilt\\lib\\phantom\\bin\\phantomjs.exe',
      'C:\\Users\\Markus\\AppData\\Roaming\\npm\\node_modules\\highcharts-export-server\\lib/../phantom/worker.js',
      'C:\\Users\\Markus\\AppData\\Roaming\\npm\\node_modules\\highcharts-export-server\\lib/../'
    ],
    pid: 28908,
    stdin: Socket {
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: null,
      _readableState: [ReadableState],
      readable: false,
      _events: [Object: null prototype],
      _eventsCount: 1,
      _maxListeners: undefined,
      _writableState: [WritableState],
      writable: true,
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: null,
      _server: null,
      [Symbol(asyncId)]: 8,
      [Symbol(kHandle)]: [Pipe],
      [Symbol(kSetNoDelay)]: false,
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: null,
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kCapture)]: false,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0
    },
    stdout: Socket {
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: null,
      _readableState: [ReadableState],
      readable: true,
      _events: [Object: null prototype],
      _eventsCount: 3,
      _maxListeners: undefined,
      _writableState: [WritableState],
      writable: false,
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: null,
      _server: null,
      [Symbol(asyncId)]: 9,
      [Symbol(kHandle)]: [Pipe],
      [Symbol(kSetNoDelay)]: false,
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: null,
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kCapture)]: false,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0
    },
    stderr: Socket {
      connecting: false,
      _parent: null,
      _host: null,
      _readableState: [ReadableState],
      readable: true,
      _events: [Object: null prototype],
      _eventsCount: 3,
      _maxListeners: undefined,
      _writableState: [WritableState],
      writable: false,
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: null,
      _server: null,
      [Symbol(asyncId)]: 10,
      [Symbol(kHandle)]: [Pipe],
      [Symbol(kSetNoDelay)]: false,
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: null,
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kCapture)]: false,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0
    },
    stdio: [ [Socket], [Socket], [Socket] ],
    [Symbol(kCapture)]: false
  },
  workStartTime: 1623148952051,
  ondone: [Function],
  workcount: 16,
  incoming: "ReferenceError: Can't find variable: Intl\r\n" +
    '\r\n' +
    '  undefined:108\r\n' +
    '  :83 in P\r\n' +
    '  :108\r\n' +
    '  :83\r\n' +
    '{"filename":"chart.png"}',
  id: 1,
  doDone: [Function: doDone],
  restart: [Function],
  work: [Function],
  allowRestart: true
}
markuspalme commented 3 years ago

This seems to be related to Highcharts 9.1.1. When I select version 9.1.0 during the installation it works.

markuspalme commented 3 years ago

The issue can be reproduced on Windows and Linux (WSL).

rpaslavskyy-amplify commented 3 years ago

The same for me

JPurinsh commented 3 years ago

Those looking for a quick way to fix this as part of an automatic install: Set HIGHCHARTS_VERSION=9.1.0 in the environment or just set it before the install command like this:

export HIGHCHARTS_VERSION=9.1.0
npm -g install highcharts-export-server

Use ACCEPT_HIGHCHARTS_LICENSE=1 to automatically accept the license.

AbramovichCp commented 3 years ago

The same problem

ardentia commented 3 years ago

Those looking for a quick way to fix this as part of an automatic install: Set HIGHCHARTS_VERSION=9.1.0 in the environment or just set it before the install command like this:

export HIGHCHARTS_VERSION=9.1.0
npm -g install highcharts-export-server

Use ACCEPT_HIGHCHARTS_LICENSE=1 to automatically accept the license.

This fixes the problem, thank you @JPurinsh! For those that execute custom code and are using the node package and not the CLI: you need to add allowCodeExecution: 1 as a top-level property to the Highcharts config object you are passing to the exporter.

KacperMadej commented 3 years ago

Related to https://github.com/highcharts/highcharts/issues/15938 Should be fixed by https://github.com/highcharts/highcharts/pull/15940

jszuminski commented 1 year ago

Closing as it was solved by https://github.com/highcharts/highcharts/pull/15940.