Hello,
I am encountering a TypeScript syntax error in the type definitions provided by the aspose.cells.node
package. The error occurs when I try to build my project using TypeScript.
Error Details
The specific error message is:
node_modules/aspose.cells.node/types.d.ts:16569:28 - error TS1005: ‘,’ expected.
16569 constructor(obj: Aspose::Cells::Font);
~
Steps to Reproduce
- Install the
aspose.cells.node
package.
- Create a TypeScript project and include the
aspose.cells.node
package.
- Attempt to build the project using TypeScript.
Environment
- Package Version:
aspose.cells.node@25.2.1
- TypeScript Version:
4.6.2
- Node.js Version:
16.x
and above
- Operating System: macOS
Suggested Fix
The issue seems to be with the use of the ::
namespace resolution operator, which is not valid in TypeScript. The correct syntax should use the .
operator for namespaces.
Here is the problematic line:
constructor(obj: Aspose::Cells::Font);
And here is the suggested fix:
constructor(obj: Aspose.Cells.Font);
Additional Information
Here is the relevant excerpt from the types.d.ts file:
/**
- Represents the text options.
/
export class TextOptions extends Font {
/*
- Constructs from a parent object convertible to this.
- @param obj - The parent object.
/
constructor(obj: Aspose::Cells::Font); // Problematic line
/*
- Gets and sets the name of the shape.
/
getName(): string;
/*
- Gets and sets the name of the shape.
- @param value - The value to set.
*/
setName(value: string): void;
// Other methods…
}
@Mukul_NAKAD,
Thank you for providing the details.
It seems you are getting an issue when building the project with Aspose.Cells for Node.js via C++ using typescript on macOS. We need to conduct a thorough assessment of the issue you mentioned to determine whether it pertains to the type definitions of aspose.cells.node
or something else. We will get back to you soon with our findings and updates.
@Mukul_NAKAD
Thanks for point out our mistake. We’ll correct it in the next release(v25.4). Currently, please correct it to constructor(obj: Font);
manually .
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): CELLSNODEJSCPP-37
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Thanks,
But after fixing it I am getting other errors in the same type.d.ts file.
@Nick.Liu Can you please mention the last stable version of aspose.cells.node so that I can deploy my project without any external code change.
node_modules/aspose.cells.node/types.d.ts:57780:20 - error TS1039: Initializers are not allowed in ambient contexts.
57780 static Black = new Color(0x00, 0x00, 0x00);
~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/aspose.cells.node/types.d.ts:57781:19 - error TS1039: Initializers are not allowed in ambient contexts.
57781 static Navy = new Color(0x00, 0x00, 0x80);
~~~~~~~~~~~~~~~~~~~~~~~~~~~
@Mukul_NAKAD
Thank you for providing the details. I will use tsc command to compile and fix the types.d.ts file. When the compilation is successful, I will provide you with a types.d.ts file. When you successfully build the project, I will publish it to npmjs.
@Mukul_NAKAD
I fixed the types.d.ts, and build a ts application with tsc successfully. Please try the attachment. If you comfirmed, I will publish it to npmjs. Thanks.
types.d.ts.zip (247.3 KB)
Thanks @Nick.Liu,
Will let you know if it works
Hi @Nick.Liu
I have tried building with the file you have shared. Build has been completed successfully without any issue.
Thanks
@Mukul_NAKAD
Thank you for your feedback. I’m glad your issue has been resolved. If you have any questions, please feel free to contact us at any time.
@Mukul_NAKAD
The fix (v25.3.1) has been released to npmjs.
@Nick.Liu
I am getting below error while downloading the latest package.
npm ERR! code ETARGET
npm ERR! notarget No matching version found for aspose.cells.node@25.3.1.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn’t exist.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mukul/.npm/_logs/2025-03-17T17_51_54_573Z-debug-0.log
@Mukul_NAKAD,
We are sorry that you are getting an error while downloading the latest fix. Let us evaluate it and we will get back to you soon.
@Mukul_NAKAD
Here are the steps I took to test the update:
- Create an empty directory node-test
- Run npm i aspose.cells.node@25.3.0 in the node-test directory. At this time, the version of node_modules/aspose.cells.node/package.json is 25.3.0
- Run npm update aspose.cells.node. The update is successful. At this time, the version of node_modules/aspose.cells.node/package.json is 25.3.1
The installation and update of aspose.cells.node only downloads files from npmjs. There is no other operation that requires local compilation. I think your update failure may be related to your nodejs and npm versions.
Thanks @Nick.Liu,
I am able to download it. Don’t know what was happening.
@Mukul_NAKAD,
It’s great to hear that you’ve successfully downloaded the latest fix! If you have any further questions or feedback, please don’t hesitate to reach out to us anytime.
Hi,
I am getting below error on my production environment.
{
“errorType”: “TypeError”,
“errorMessage”: “Cannot read properties of undefined (reading ‘prototype’)”,
“trace”: [
“TypeError: Cannot read properties of undefined (reading ‘prototype’)”,
" at Object. (/var/task/node_modules/aspose.cells.node/aspose.cells.js:380:24)“,
" at Module._compile (node:internal/modules/cjs/loader:1364:14)”,
" at Module._extensions…js (node:internal/modules/cjs/loader:1422:10)“,
" at Module.load (node:internal/modules/cjs/loader:1203:32)”,
" at Module._load (node:internal/modules/cjs/loader:1019:12)“,
" at Module.require (node:internal/modules/cjs/loader:1231:19)”,
" at require (node:internal/modules/helpers:177:18)“,
" at Object. (/var/task/Tasks/ResolveFormula.js:16:45)”,
" at Module._compile (node:internal/modules/cjs/loader:1364:14)“,
" at Module._extensions…js (node:internal/modules/cjs/loader:1422:10)”
]
}
Even though I have tried deploying my code to a lambda with same architecture and node version as my local environments. But I am still getting the above error on lambda as well. I am facing this issue only on hosted environments not on local
@Mukul_NAKAD,
Thank you for sharing the error details.
We will review the issue and provide you with an update soon.
@Mukul_NAKAD
What are your production environment, CPU architecture and OS? From the error log, it seems that the nodejs addon module that matches the OS and CPU architecture cannot be successfully loaded, such as aspose.cells.node.darwin.arm64, resulting in exports.CustomXmlShape being undefined. Please check whether there is a directory such as aspose.cells.node.linux.x64, aspose.cells.node.win32.x64, aspose.cells.node.darwin.x64 or aspose.cells.node.darwin.arm64 in the node_modules directory. Thanks.
@Mukul_NAKAD
Aspose.Cells for Node.js via C++ doesn’t support Linux arm64 architecture currently. Please try it on Linux x64 environment. Thanks.