heavysixer / node-pptx

Generate PPTX files on the server-side with JavaScript.
MIT License
161 stars 44 forks source link

TypeError: zip.files.hasOwnProperty is not a function #83

Closed lengerrong closed 1 year ago

lengerrong commented 3 years ago

TypeError: zip.files.hasOwnProperty is not a function at PowerPointFactory.loadFromRawFileData (node_modules/nodejs-pptx/lib/factories/index.js:42:27) at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:95:5) at async Presentation.loadExistingPPTX (node_modules/nodejs-pptx/lib/presentation.js:99:13) at async Composer.load (node_modules/nodejs-pptx/lib/composer.js:15:9)

woemler commented 2 years ago

I ran into this same error when using this library in an AWS lambda function with a NodeJS environment.

xuxicheta commented 2 years ago

Same error in pure project with node-pptx only. On Windows 10.

kobusan commented 2 years ago

Hi guys. Same error too and I resolved.

/node_modules/nodejs-pptx/lib/factories/index.js:42

- if (zip.files.hasOwnProperty(key)) {
+ if (Object.prototype.hasOwnProperty.call(zip.files, key)) {

like https://github.com/heavysixer/node-pptx/pull/84/commits/efe21998639f2b5295f4350e860cfe0a2238a2d7

have a good day. :)

adi-mb commented 2 years ago

This solves the issue - can you please create a tag or new version I cannot you this package