marcbachmann / node-html-pdf

This repo isn't maintained anymore as phantomjs got dreprecated a long time ago. Please migrate to headless chrome/puppeteer.
MIT License
3.56k stars 544 forks source link

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

Open Shijors opened 1 year ago

Shijors commented 1 year ago

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){ } });

hypo-thesis commented 1 year ago

did you ever solve this?