Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read properties of undefined (reading 'call') #196

Open
xxxx96923 opened this issue Oct 23, 2024 · 6 comments
Open

Cannot read properties of undefined (reading 'call') #196

xxxx96923 opened this issue Oct 23, 2024 · 6 comments

Comments

@xxxx96923
Copy link

import XlsxTemplate from "xlsx-template";

const template = new XlsxTemplate(data);

TypeError: Cannot read properties of undefined (reading 'call')
at new Queue (index.js:12:16)
at node_modules/.pnpm/[email protected]/node_modules/image-size/dist/index.js (index.js:13:15)
at __require2 (chunk-LK32TJAX.js?v=6aff3c6a:18:50)
at node_modules/.pnpm/[email protected]/node_modules/xlsx-template/lib/index.js (index.js:7:14)
at __require2 (chunk-LK32TJAX.js?v=6aff3c6a:18:50)
at index.js:1610:18

@kant2002
Copy link
Collaborator

What’s the structure of the data which are passed to the library? Would be great to have small snippet of code which reproduce the problem.

@xxxx96923
Copy link
Author

import XlsxTemplate from "xlsx-template";
import JSZipUtils from "jszip-utils";
import { saveAs } from "file-saver";
export const exportXlsx = (tempXlsxPath, item, fileName, option = {}) => {
JSZipUtils.getBinaryContent(tempXlsxPath, (error, data: Buffer) => {
if (error) {
throw error;
}
const template = new XlsxTemplate(data, option);
// const sheetNumber = 1;
// template.substitute(sheetNumber, item);
// let templateData = template.generate({ type: "blob" });
// saveAs(templateData, ${fileName}.xlsx);
});
};

error line: const template = new XlsxTemplate(data, option);

@kant2002
Copy link
Collaborator

It would be hard for me to guess what exactly happens. Can you show shape of the data object. and template which reproduce the issue. You may try to remove sensetive information from the template to not disclose your customer.

@xxxx96923
Copy link
Author

微信截图_20241027091935

Did not call exportXlsx method, is the site initialization when the error, I have not passed the data

@xxxx96923
Copy link
Author

As soon as I opened the relevant page, the console reported an error. I haven't clicked the export button yet

@xxxx96923
Copy link
Author

I added console.log and found that the exportXlsx method did not enter, but it just reported an error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants