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)
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'
}
My code was
await pdf.create(htmlcontent, options).toFile(filePath, (err: Error, response: pdf.FileInfo) => { if (err){ } });