node-html-pdf icon indicating copy to clipboard operation
node-html-pdf copied to clipboard

html-pdf: Unknown Error throw new ERR_INVALID_ARG_TYPE(name, 'string', value); Docker

Open Shijors opened this issue 2 years ago • 1 comments

Error: html-pdf: Unknown Error internal/validators.js:120 throw new ERR_INVALID_ARG_TYPE(name, 'string', value); ^

TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received null at validateString (internal/validators.js:120:11) at normalizeSpawnArguments (child_process.js:411:3) at spawn (child_process.js:547:16) at Object. (/app/dist/node_modules/phantomjs-prebuilt/bin/phantomjs:22:10) at Module._compile (internal/modules/cjs/loader.js:999:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) at internal/main/run_main_module.js:17:47 { code: 'ERR_INVALID_ARG_TYPE' }

at ChildProcess.respond (/app/dist/node_modules/html-pdf/lib/pdf.js:134:17)
at ChildProcess.emit (events.js:314:20)
at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)

My code was

  ```let filePath: string = path.resolve(process.cwd(),"public","downloads",fileName);

await pdf.create(htmlcontent, options).toFile(filePath, (err: Error, response: pdf.FileInfo) => { if (err){ } });

Shijors avatar Dec 16 '22 16:12 Shijors

did you ever solve this?

hypo-thesis avatar Aug 12 '23 22:08 hypo-thesis