hummusRecipe
hummusRecipe copied to clipboard
no such file or directory, scandir '\wwwroot\node_modules\hummus-recipe\fonts
We have used it to merge pdfs and we are trying to use it on azure hosted env.
Code
const pdfDoc = new HummusRecipe('Appendix_PDF/' + 'xxxxx'.pdf', 'Appendix_PDF/' + 'xxx11-.pdf');
const miniapp1 = 'Appendix_PDF/miniappendix1.pdf';
const miniapp7 = 'Appendix_PDF/miniappendix7.pdf';
pdfDoc
.appendPage(miniapp1)
.appendPage(miniapp7)
.endPage()
.endPDF(() => {
console.log('PDF generated successfully'); blobStorage();
},err => {
console.log(err);
});
and we get this as error. I did npm install many times but it has not helped at all.
**Error: ENOENT: no such file or directory, scandir 'D:\home\site\wwwroot\node_modules\hummus-recipe\fonts'**
at Object.readdirSync (fs.js:785:3)
at Recipe._loadFonts (D:\home\site\wwwroot\node_modules\hummus-recipe\lib\font.js:18:10)
at new Recipe (D:\home\site\wwwroot\node_modules\hummus-recipe\lib\Recipe.js:54:14)
at mergePDF (D:\home\site\wwwroot\controllers\master\mini-pdf-generation.controller.js:85:28)
at D:\home\site\wwwroot\controllers\master\mini-pdf-generation.controller.js:71:17
at respond (D:\home\site\wwwroot\node_modules\html-pdf\lib\pdf.js:129:5)
at Socket.onData (D:\home\site\wwwroot\node_modules\html-pdf\lib\pdf.js:108:17)
at Socket.emit (events.js:189:13)
at addChunk (_stream_readable.js:284:12)
at readableAddChunk (_stream_readable.js:265:11)
at Socket.Readable.push (_stream_readable.js:220:10)
at Pipe.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
Can you just quick check if the D:\home\site\wwwroot\node_modules\hummus-recipe\fonts
exist in your node_modules
?
As I can confirm, it is included in the package https://github.com/chunyenHuang/hummusRecipe/tree/master/fonts
@chunyenHuang It has been there from the start, still I have no idea why this error, hence approaching you here. We even tried to pass the fonts path while initializing it as below.
We even tried installing the package again to no avail.
const pdfDoc = new HummusRecipe('new', output, { fontSrcPath })
@chunyenHuang What do you suggest? Is there going to be a fix soon? so that we can wait until it is resolved.
Unfortunately, I can not reproduce your issue since I dont have a windows environment.
But you may hack the code here to give it a try:
https://github.com/chunyenHuang/hummusRecipe/blob/master/lib/Recipe.js#L55
Change path.join
to path.resolve
or test with some absolute path.