ENOENT:没有这样的文件或目录:即使该文件夹存在

时间:2019-07-02 17:46:12

标签: node.js node-modules

我试图通过邮递员提交表格,但是我一直收到没有此类文件的错误,即使文件存在,pdf也不会保存到本地pc中提到的路径。节点不断抛出错误:

  

[错误:ENOENT:没有这样的文件或目录

     

错误:ENOENT:没有这样的文件或目录,请打开   'D:\ lims \ Generate_PDF_for_Forms \ ViralFlexSeqSubmissionForm_Dash_7-2-2019_13:37:42.pdf']         errno:-4058,         代码:“ ENOENT”,         syscall:“打开”,         路径:          'D:\ lims-customer \ Generate_PDF_for_Forms \ ViralFlexSeqSubmissionForm_Dash_7-2-2019_13:37:42.pdf'。

简码:

    const printer = new pdfMakePrinter(fontDescriptor);
    const doc = printer.createPdfKitDocument(docDefinition);
    // functions getDateAndTime returns date in mm/dd/yyyy format followed by time in HH:MM:SS:Milliseconds
    const dateAndTime = getDateAndTime();
    const pdfName = 'ViralFlexSeqSubmissionForm' + '_' + user.lastName + '_' + dateAndTime + '.pdf';
    console.log("HereYouGo::"+pdfName);
    doc.pipe(fs.createWriteStream('Generate_PDF_for_Forms/' + pdfName).on('error', (err) => {
            console.log(err);
        })
    );

0 个答案:

没有答案