mk.developer
Posts: 83
Joined: Wed Mar 17, 2021 6:07 pm

Export server not configured error

I am trying to setup Highchart export server locally.

I have created a node JS app with the following code:

Code: Select all

// Initialize the exporter
    chartExporter.initPool();

    // Chart details object specifies chart type and data to plot
    const chartDetails = {
        type: "png",
        options: {
            chart: {
                type: "pie"
            },
            title: {
                text: "Heading of Chart"
            },
            plotOptions: {
                pie: {
                    dataLabels: {
                        enabled: true,
                        format: "<b>{point.name}</b>: {point.y}"
                    }
                }
            },
            series: [
                {
                    data: [
                        {
                            name: "a",
                            y: 100
                        },
                        {
                            name: "b",
                            y: 20
                        },
                        {
                            name: "c",
                            y: 50
                        }
                    ]
                }
            ]
        }
    };

    chartExporter.export(chartDetails, (err, res) => {
        // Get the image data (base64)
        let imageb64 = res.data;
        // Filename of the output
        let outputFile = "pie2.png";


        var fileName = '';
        var resolvedBase = path.resolve(staticIMAGEBasePath);
        //fileName = path.join(resolvedBase, guid + '.svg');
        fileName = path.join(resolvedBase, outputFile);

        // Save the image to file
        fs.writeFileSync(fileName, imageb64, "base64", function (err) {
            if (err) console.log(err);
        });
        chartExporter.killPool();
    });

However, it creates an image with "Export server not configured".
pie2.png
pie2.png (8.42 KiB) Viewed 4642 times
I have installed the export server using

Code: Select all

npm install highcharts-export-server
(without -g). I tried running "

Code: Select all

node node_modules\highcharts-export-server\build.js
" but no luck.
mk.developer
Posts: 83
Joined: Wed Mar 17, 2021 6:07 pm

Re: Export server not configured error

Hi, any update on this please?
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Export server not configured error

Hi mk.developer,

I have forwarded your question to our export server developer and he will answer asap.

Regards!
Mateusz Bernacik
Highcharts Developer
mk.developer
Posts: 83
Joined: Wed Mar 17, 2021 6:07 pm

Re: Export server not configured error

Ok, thanks for the update.
piotr.m
Posts: 1433
Joined: Mon Nov 18, 2019 8:15 am

Re: Export server not configured error

Hi,

Try to go through the installation steps described on our website:
https://github.com/highcharts/node-expo ... er#install

Code: Select all

git clone https://github.com/highcharts/node-export-server
npm install
npm link

Then try to start the local export server with the following command:

Code: Select all

node ./bin/cli.js --enableServer 1

Let us know what output you get.

Kind Regards
mk.developer
Posts: 83
Joined: Wed Mar 17, 2021 6:07 pm

Re: Export server not configured error

Thanks for your reply. Unfortunately we dont have access to "git clone https://github.com/highcharts/node-export-server" so we have to use "npm install highcharts-export-server" instead.

I tried running "node .\node_modules\highcharts-export-server\bin\cli.js --enableServer 1" which started the server.
server.PNG
server.PNG (5.64 KiB) Viewed 4586 times
I opened another command window and ran the node js app however it did not fix the issue.
mk.developer
Posts: 83
Joined: Wed Mar 17, 2021 6:07 pm

Re: Export server not configured error

Is there any update on this?
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Export server not configured error

Hi mk.developer,

Please try following method:
- install highcharts-export-server

- run few times this command:

Code: Select all

node node_modules\highcharts-export-server\build.js
For some reason sometimes it doesn't work for the first time, we're still investigating why.

- after running it multiple times check content of this file: .\node_modules\highcharts-export-server\phantom\export.html
It should contain minified Highcharts scripts. If it doesn't, then most likely there is a problem with downloading these scripts. On our side everything seems to work correctly and we thing that the problem could be caused by firewall settings.

If the file contains minified scripts, please run again an export server test from our docs.

Let me know if it helps.
Regards!
Mateusz Bernacik
Highcharts Developer
marcetera
Posts: 4
Joined: Fri Dec 30, 2022 4:21 am

Re: Export server not configured error

Hi !
Im getting the same error . When running the server and calling by using CURL ; no problem
But I need to use Highcharts as a dependency in my node.js app .

Im using node 19.0.0 ( I also tried with 15.14.0, 16, etc ), and Highcharts v2.1.0

I have run node node_modules\highcharts-export-server\build.js , few times but after running my app , I still get the same

Server export not configured .

In my node-export-server\node_modules\highcharts-export-server\phantom\export.html , I can see this .



{{css}} {{js}}
Export Server not configured!
Please complete the configuration by running node build.js in the export server root.

If you installed by running npm install -g highcharts-export-server and declined the license agreement, you need to re-install to confirm.


Could you help me please ?
Thanks in advance :)
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: Export server not configured error

Hello,

There is a similar thread on the forum that may help you: viewtopic.php?f=9&t=47543&start=30

Let me know if that was what you were looking for!
Best regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/
marcetera
Posts: 4
Joined: Fri Dec 30, 2022 4:21 am

Re: Export server not configured error -- DOCKERIZE node.js app

Hi guys !
I have a new problem .
I can configure node-export-server, and use it properly as a dependency in my node.js app .
But , now I need to dockerize my app ; and I would like to configure node-export-server and the highchart-export-server ( by node build.js , and node node_modules/highcharts-export-server/build.js ) in detached more .
When prompted I can accept the licence and leave the rest as 'no' ; I want that configuration , but since Im trying to dockerize it I would like to get the same in the building time of the docker . So, may I get the same in detached mode ?

I already tried by using environment variables but ... in that case I got the well known EXPORT SERVER NOT CONFIGURED .
When I enter , step by step .... everything goes ok .
May u help me ?
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: Export server not configured error

Hello,

Maybe try using the new version of the Export server that was released some time ago, it's a bigger change and it might solve the problem.

You can download it from this branch here: https://github.com/highcharts/node-expo ... /puppeteer

Regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/
marcetera
Posts: 4
Joined: Fri Dec 30, 2022 4:21 am

Re: Export server not configured error -- not displaying annotations .

Does the highcharts-export-server support annotations ? I can not display the annotations in my charts .

Im using nodejs 15.14.0 .
My installation steps are :
1- git clone ...
2- cd node-export-server
3- node build.js
( Im accepting the licences, ENTERS ... and when prompting about annotations I write 'yes' , but I only get the well known error " export server not configured "
Could you help me please ?

Code: Select all

const exporter = require('highcharts-export-server');
const annotations = require('highcharts-annotations');

// Set up the chart options
const chartOptions = {
    chart: {
        type: 'line',
    },
    title: {
        text: 'My Chart',
    },
    xAxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
    },
    series: [{
        name: 'My Series',
        data: [1, 3, 2, 4, 5, 7, 6, 8, 9, 10, 11, 12],
    }],
};

// Add annotations to the chart options
const annotationsOptions = {
    annotations: [{
        labelOptions: {
            allowOverlap: true,
            align: 'right',
            verticalAlign: 'middle',
            backgroundColor: 'rgba(255,255,255,0.5)',
            borderRadius: 5,
            borderWidth: 1,
            borderColor: '#AAA',
            padding: 5,
        },
        labels: [{
            point: {
                xAxis: 0,
                yAxis: 0,
                x: 2,
                y: 7,
            },
            text: 'Annotation text here',
        }],
    }],
};

// Initialize Highcharts-Export-Server
exporter.initPool();

// Export the chart as a PNG image
exporter.export({
    type: 'png',
    options: chartOptions,
    annotations: annotationsOptions.annotations,
}, (err, res) => {
    if (err) {
        console.error(err);
    } else {
        console.log(res.data); // Base64-encoded PNG image data
    }
    exporter.killPool();
});
User avatar
dawid.d
Posts: 807
Joined: Thu Oct 06, 2022 11:31 am

Re: Export server not configured error

Hello marcetera,

Thanks for contacting us with your question!

Check out this issue on our official GH, it may be helpful for you: https://github.com/highcharts/node-expo ... issues/121

You can also try the puppeter version, which will soon complete the testing process and be released, as Michał wrote above.
https://github.com/highcharts/node-expo ... /puppeteer

​If you have further inquiries, you may reach out to me at any time.
Best regards
Dawid Draguła
Highcharts Developer
ashok3
Posts: 2
Joined: Tue Jun 06, 2023 9:33 am

Re: Export server not configured error

I am using nodejs v18.16.0
My installation steps are :
a)
1- git clone ...
2- cd node-export-server
3- node build.js
I am accepting the licenses, ENTERS ...
after that start server using the following command
C:\Program Files\nodejs\node_modules\highcharts-export-server>node bin/cli.js --enableServer 1

server started successfully in the 7801 port.
While trying to execute the CURL command.

curl -H "Content-Type: application/json" -X POST -d "{ \"infile\": { \"title\": { \"text\": \"Steep Chart\" }, \"xAxis\": { \"categories\": [ \"Jan\", \"Feb\", \"Mar\" ] }, \"series\": [ { \"data\": [ 29.9, 71.5, 106.4 ] } ] }, \"width\": 1200 }" localhost:7801 -o output-file.png



output-file.png generated but the image contains Export server not configured error instead of the chart.

b) Even though I have tried the other installation method
npm install highcharts-export-server -g

I couldn't able to generate proper output files.

c) I have tried with a deprecated version of java based highcharts server. But For JSON input it throws a bad request .its takes XML input and charts generated correctly.
https://www.highcharts.com/docs/export- ... -phantomjs

The requirement is based on JSON input charts image needs to be generated.

Could you please help me to generate charts based on the given JSON input?

Return to “Highcharts Usage”