-
-
Notifications
You must be signed in to change notification settings - Fork 360
Open
Description
Hi all, I've been attempting to execute this child process but after much research on both the github and Stackoverflow, still stumped.
Here is my code that is throwing an error.
const officeToPdfPath = 'C:\\\\Users\\ptran\\Desktop\\expressTesting\\OfficeToPDF.exe';
const uploadsPath = 'C:\\\\Users\\ptran\\Desktop\\expressTesting\\uploads';
let command;
let outputName = currentDate.getTime() + "converted.pdf"
command = `${officeToPdfPath} ${uploadsPath}\\${filename} ${uploadsPath}\\${outputName}`;
return new Promise((resolve, reject) => {
exec(command, (error, stdout, stderr) => {
if (error) {
console.log(error);
reject(error);
return;
}
if (stderr) {
console.log(stderr);
reject(new Error(stderr));
return;
}
else if (stdout) {
console.log(stdout + "GOOD PDF");
}
console.log("Resolve Now");
console.log(uploadsPath, outputName)
resolve(uploadsPath + outputName);
});
This is not the full code but seems like the issue is within the exec itself.
My error:
node:internal/process/promises:289
triggerUncaughtException(err, true /* fromPromise */);
^
Error: Command failed: C:\\Users\ptran\Desktop\expressTesting\OfficeToPDF.exe C:\\Users\ptran\Desktop\expressTesting\uploads\file-1710368425793.docx C:\\Users\ptran\Desktop\expressTesting\uploads\1710368425806converted.pdf
at ChildProcess.exithandler (node:child_process:422:12)
at ChildProcess.emit (node:events:518:28)
at maybeClose (node:internal/child_process:1105:16)
at ChildProcess._handle.onexit (node:internal/child_process:305:5) {
code: 3,
killed: false,
signal: null,
cmd: 'C:\\\\Users\\ptran\\Desktop\\expressTesting\\OfficeToPDF.exe C:\\\\Users\\user\\Desktop\\expressTesting\\uploads\\file-1710368425793.docx C:\\\\Users\\ptran\\Desktop\\expressTesting\\uploads\\1710368425806converted.pdf'
}
Node.js v20.11.1
I've double checked as well to make sure that the user is an admin and running both the service as "Local System account"..."allow Service to interact with desktop" and Using a local admin account as well.
Metadata
Metadata
Assignees
Labels
No labels