在 pdffiller 上出现错误:spawn pdftk ENOENT

geting Error on pdffiller : spawn pdftk ENOENT

我在我的项目中使用 pdffiller

npm install pdffiller

这是我的代码

return new Promise((resolve, reject) => {
          pdfFiller.fillFormWithFlatten(sourcePDF,distPath,formValues,false,function (err) {
              if (err) {
                return reject(err);
              }
              return resolve({
                url: distPath
              });
            }
          );
        });

我的 pdf 是可编辑的,有复选框、输入框等

that pdf saved on sourcePDF directory

pdf filled with formValues object

每次我尝试填写 pdf 时都会出现此错误

Error: spawn pdftk ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn pdftk',
  path: 'pdftk',
  spawnargs: [
    'public/uploads/test/0.pdf',
    'fill_form',
    'temp_data1601654837427pd8bn.fdf',
    'output',
    'public/uploads/providers/4939/test/9e6020c5-2369-45fd-b75b-250d7edb3ec5-populate.pdf'
  ],
  cmd: 'pdftk public/uploads/test/0.pdf fill_form temp_data1601654837427pd8bn.fdf output public/uploads/providers/4939/test/9e6020c5-2369-45fd-b75b-250d7edb3ec5-populate.pdf'
}

坦克 AKX

可以安装在snap上

sudo snap install pdftk

我的问题已解决