电子-fs.js:114未捕获的错误:ENOENT:没有此类文件或目录,请打开

时间:2019-01-24 11:26:39

标签: node.js electron

我有一个带有export按钮的简单应用程序。单击此按钮后,打开一个弹出窗口以添加更多数据,并使用JsPDF创建pdf。 当我单击export按钮时,弹出窗口会正确显示,但是单击finish按钮(将其关闭),则该错误会出现在控制台上:

fs.js:114 Uncaught Error: ENOENT: no such file or directory, open
at Object.openSync (fs.js:436)
at Object.module.(anonymous function) [as openSync] (ELECTRON_ASAR.js:160:31)
at Object.readFileSync (fs.js:341)
at Object.fs.readFileSync (ELECTRON_ASAR.js:580)
at Object.exports.base64Sync (/Users/th3g3ntl3man/Repository/thermowell-design/node_modules/base64-img/base64-img.js:60)
at HTMLButtonElement.$.on (export.min.js:1)
at HTMLDocument.dispatch (jquery-3.3.1.min.js:2)
at HTMLDocument.y.handle (jquery-3.3.1.min.js:2)

这是一个与export按钮链接的小代码:

const JsPDF   = require('jspdf');

let customer, project, tag;
var pdf = new JsPDF();


$(document).ready( () => {

    $(document).on("click","#additionalData", () => {

        customer = $('#customer').val().trim();
        tag = $('#tag').val().trim();
        pN = $('#pN').val().trim();

        pdf.text(50, 50, 'this is a test');

        pdf.save(customer + '_' + tag + '.pdf');
        $("#custom-modal").modal("hide");
    });


    $('#esporta').click( () => {
        $("#custom-modal").modal("show");
    });

});

additionalData是插入新数据的形式,而custom-modal是弹出窗口。

0 个答案:

没有答案