Open MajedSardar64 opened 6 months ago
Hey there, this looks like a windows issue with the sub-dependency "pdfjs-dist". I won't be able to reproduce / test windows issues and recommend checking this dependency for similar issues.
As a side note, it's always a good idea to add your NodeJS version, OS version etc. for context.
PRs are welcome
A previous application showing similar paths after an install may have problems with libraries that were previously installed.
async function asPDF({ fullFilePath = "", filename = "" }) {
outputdir = '/app/collector/processSingleFile/convert/images' try { const pdfExportImagesModule = await import('pdf-export-images'); const exportImages = pdfExportImagesModule.exportImages;
const images = await exportImages(fullFilePath, outputdir);
console.log('Exported images========================', images.length, 'images');
} catch (error) { console.error(error); } }
TypeError: Promise.withResolvers is not a function at file:///app/collector/node_modules/pdfjs-dist/build/pdf.mjs:5300:35 at ModuleJob.run (node:internal/modules/esm/module_job:195:25) at async ModuleLoader.import (node:internal/modules/esm/loader:337:24) at async importModuleDynamicallyWrapper (node:internal/vm/module:432:15) at async asPDF (/app/collector/processSingleFile/convert/asPDF.js:18:35) at async processSingleFile (/app/collector/processSingleFile/index.js:54:10) at async /app/collector/index.js:37:9
Error processing images [Error: ENOENT: no such file or directory, scandir '/app/collector/processSingleFile/convert/images'] { errno: -2, code: 'ENOENT', syscall: 'scandir', path: '/app/collector/processSingleFile/convert/images' }
I am getting the same error i am using this build in dockerfile. With os running in ubuntu latest version. And the nodejs version is 18.12.1
pdfjs-dist Update to latest Version 4.6.82
@MajedSardar64 if this sentence suggests upgrading the dependency, feel free to create a PR.
file:///C:/Users/SARDAR/Desktop/IMG_text_OCR/node_modules/pdfjs-dist/build/pdf.mjs:5300 var packageCapability = Promise.withResolvers(); ^
TypeError: Promise.withResolvers is not a function