We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error about running Aspose.barcode

Hello,

I am trying to run my function using aspose.barcode library but i got the followoing error:

/DemoJs2/node_modules/aspose.barcode/lib/Joint.js:6
javaClass;
^

SyntaxError: Unexpected token ;
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (/DemoJs2/node_modules/aspose.barcode/lib/AsposeBarcode.js:3:16)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:789:10)

Could you please help me to fix this error.

Thank you

@jijikate,

It looks like you are using Aspose.BarCode for Node.js via Java. Could you please share your sample code (runnable) with sample image file (if any) to reproduce the issue. We will check your issue soon.

I am trying to run this example:

const fs = require(“fs”);
const barcode_ = require(“aspose.barcode”);
const aspose_barcode = barcode_.AsposeBarcode
let BarcodeGenerator = aspose_barcode.BarcodeGenerator;
let EncodeTypes = aspose_barcode.EncodeTypes;
let BarCodeReader = aspose_barcode.BarCodeReader;

function generateAndRead()
{
let generator = new BarcodeGenerator(EncodeTypes.CODE_128, “12367891011”);
let file_path = “resources/generating/setBarcodeType.png”;
generator.save(file_path, “PNG”);
let image_data_base64 = fs.readFileSync(file_path).toString(‘base64’);
let reader = new BarCodeReader(image_data_base64, null, DecodeType.ALL_SUPPORTED_TYPES);
reader.readBarCodes().forEach(function(result, i, results)
{
console.log("Recognized barcode code text: " + result.getCodeText(false) + “\n”);
console.log("Recognized barcode code type: " + result.getCodeTypeName() + “\n”);
});
}

When I try to run it it displays the previous sent error.

Thank you for your help.

@jijikate,

It looks like configuration issue on your end. Do you find the error with any code sample or with your particular example code (you pasted)? We will also be looking into your issue and get back to you soon.

Yes, you are right. I had a problem with the Node.js… The solution was just upgrading the version of Node.js.

Thank you,

@jijikate,

Good to know that you are up and running again. In the event of further queries or issue, feel free to write us back.