Skip to content

converter not working on Amazon Linux 2 #10

Description

@ims-systems-00

After a successful deployment, when I run the my file conversion script as mentioned in the docs the conversion fails. my conversion script.

the script runs perfectly in local windows 10 machine and ubuntu 20.04 lts

const { convertWordFiles } = require("convert-multiple-files");
const path = require("path");

async function test() {
  try {
    const infoOutput = await convertWordFiles(
      path.resolve(__dirname, `../../temp/test02.docx`),
      "pdf",
      path.resolve(__dirname, `../../temp`)
    );
  } catch (err) {
    console.log(err);
  }
}

test();

The Error I got was this

Jul  5 11:30:02 web: /var/app/current/node_modules/convert-multiple-files/lib/utils/instdir/program/soffice.bin: error while loading shared libraries: libxslt.so.1: cannot open 
shared object file: No such file or directory
Jul  5 11:30:02 web: Error: Error converting the file
Jul  5 11:30:02 web: at /var/app/current/node_modules/convert-multiple-files/lib/index.js:68:19
Jul  5 11:30:02 web: at step (/var/app/current/node_modules/convert-multiple-files/lib/index.js:33:23)
Jul  5 11:30:02 web: at Object.next (/var/app/current/node_modules/convert-multiple-files/lib/index.js:14:53)
Jul  5 11:30:02 web: at /var/app/current/node_modules/convert-multiple-files/lib/index.js:8:71
Jul  5 11:30:02 web: at new WrappedPromise (/var/app/current/node_modules/async-listener/es6-wrapped-promise.js:13:18)
Jul  5 11:30:02 web: at __awaiter (/var/app/current/node_modules/convert-multiple-files/lib/index.js:4:12)
Jul  5 11:30:02 web: at convertWordFiles (/var/app/current/node_modules/convert-multiple-files/lib/index.js:44:75)
Jul  5 11:30:02 web: at FileHandlerService.preparePreview (/var/app/current/src/services/fileHandler.js:67:9)
Jul  5 11:30:02 web: at prepareDocumentPreview (/var/app/current/src/subprocess/fileConverter.js:20:60)
Jul  5 11:30:02 web: at async process.<anonymous> (/var/app/current/src/subprocess/fileConverter.js:27:16)
Jul  5 11:30:02 web: Error: Error converting the file
Jul  5 11:30:02 web: at /var/app/current/node_modules/convert-multiple-files/lib/index.js:68:19
Jul  5 11:30:02 web: at step (/var/app/current/node_modules/convert-multiple-files/lib/index.js:33:23)
Jul  5 11:30:02 web: at Object.next (/var/app/current/node_modules/convert-multiple-files/lib/index.js:14:53)
Jul  5 11:30:02 web: at /var/app/current/node_modules/convert-multiple-files/lib/index.js:8:71
Jul  5 11:30:02 web: at new WrappedPromise (/var/app/current/node_modules/async-listener/es6-wrapped-promise.js:13:18)
Jul  5 11:30:02 web: at __awaiter (/var/app/current/node_modules/convert-multiple-files/lib/index.js:4:12)
Jul  5 11:30:02 web: at convertWordFiles (/var/app/current/node_modules/convert-multiple-files/lib/index.js:44:75)
Jul  5 11:30:02 web: at FileHandlerService.preparePreview (/var/app/current/src/services/fileHandler.js:67:9)
Jul  5 11:30:02 web: at prepareDocumentPreview (/var/app/current/src/subprocess/fileConverter.js:20:60)
Jul  5 11:30:02 web: at async process.<anonymous> (/var/app/current/src/subprocess/fileConverter.js:27:16) null

After that I had to install the two packages libxslt and libSM and this portions was not there anymore

Jul  5 11:30:02 web: /var/app/current/node_modules/convert-multiple-files/lib/utils/instdir/program/soffice.bin: error while loading shared libraries: libxslt.so.1: cannot open 
shared object file: No such file or directory

which means library did load.

but this time i got error without any clue, that came from the following line

Jul  5 11:30:02 web: Error: Error converting the file
Jul  5 11:30:02 web: at /var/app/current/node_modules/convert-multiple-files/lib/index.js:68:19

i did put a console log in convert-multiple-files/lib/index.js:68 and I got the following output

Error: Command failed: /var/app/current/node_modules/convert-multiple-files/lib/utils/instdir/program/soffice.bin --headless --norestore --invisible --nodefault --nofirststartwizard --nolockcheck --nologo --convert-to pdf --outdir /var/app/current/temp '/var/app/current/temp/test02.docx'
    at checkExecSyncError (child_process.js:616:11)
    at Object.execSync (child_process.js:652:15)
    at /var/app/current/node_modules/convert-multiple-files/lib/index.js:61:31
    at step (/var/app/current/node_modules/convert-multiple-files/lib/index.js:33:23)
    at Object.next (/var/app/current/node_modules/convert-multiple-files/lib/index.js:14:53)       
    at /var/app/current/node_modules/convert-multiple-files/lib/index.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/var/app/current/node_modules/convert-multiple-files/lib/index.js:4:12)
    at convertWordFiles (/var/app/current/node_modules/convert-multiple-files/lib/index.js:44:75)  
    at test (/var/app/current/src/services/converter.js:6:30)
    at Object.<anonymous> (/var/app/current/src/services/converter.js:16:1)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) {
  status: 77,
  signal: null,
  output: [ null, <Buffer >, <Buffer > ],
  pid: 4311,
  stdout: <Buffer >,
  stderr: <Buffer >
}
Error: Error converting the file
    at /var/app/current/node_modules/convert-multiple-files/lib/index.js:69:19
    at step (/var/app/current/node_modules/convert-multiple-files/lib/index.js:33:23)
    at Object.next (/var/app/current/node_modules/convert-multiple-files/lib/index.js:14:53)       
    at /var/app/current/node_modules/convert-multiple-files/lib/index.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/var/app/current/node_modules/convert-multiple-files/lib/index.js:4:12)
    at convertWordFiles (/var/app/current/node_modules/convert-multiple-files/lib/index.js:44:75)  
    at test (/var/app/current/src/services/converter.js:6:30)
    at Object.<anonymous> (/var/app/current/src/services/converter.js:16:1)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47

is there any obvious reason for the problem or am I missing anything ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions