question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: a.split is not a function.

See original GitHub issue

Hello everyone, sorry my english is not very well.

I have a problem when I try to convert a file, I already installed Ghostscript and GraphicsMagick, can someone help me?

(node:8980) UnhandledPromiseRejectionWarning: TypeError: a.split is not a function at t.value (C:\Users\fagner.batista\Documents\apiPdfLinux\node_modules\pdf2pic\dist\index.min.js:1:1343) at C:\Users\fagner.batista\Documents\apiPdfLinux\node_modules\pdf2pic\dist\index.min.js:1:1586 at Promise._execute (C:\Users\fagner.batista\Documents\apiPdfLinux\node_modules\bluebird\js\release\debuggability.js:313:9) at Promise._resolveFromExecutor (C:\Users\fagner.batista\Documents\apiPdfLinux\node_modules\bluebird\js\release\promise.js:488:18) at new Promise (C:\Users\fagner.batista\Documents\apiPdfLinux\node_modules\bluebird\js\release\promise.js:79:10) at t.value (C:\Users\fagner.batista\Documents\apiPdfLinux\node_modules\pdf2pic\dist\index.min.js:1:1558) at t.<anonymous> (C:\Users\fagner.batista\Documents\apiPdfLinux\node_modules\pdf2pic\dist\index.min.js:1:5951) at tryCatch (C:\Users\fagner.batista\Documents\apiPdfLinux\node_modules\regenerator-runtime\runtime.js:45:40) at Generator.invoke [as _invoke] (C:\Users\fagner.batista\Documents\apiPdfLinux\node_modules\regenerator-runtime\runtime.js:271:22) at Generator.prototype.(anonymous function) [as next] (C:\Users\fagner.batista\Documents\apiPdfLinux\node_modules\regenerator-runtime\runtime.js:97:21) at asyncGeneratorStep (C:\Users\fagner.batista\Documents\apiPdfLinux\node_modules\@babel\runtime\helpers\asyncToGenerator.js:3:24) at _next (C:\Users\fagner.batista\Documents\apiPdfLinux\node_modules\@babel\runtime\helpers\asyncToGenerator.js:25:9) at C:\Users\fagner.batista\Documents\apiPdfLinux\node_modules\@babel\runtime\helpers\asyncToGenerator.js:32:7 at new Promise (<anonymous>) at t.<anonymous> (C:\Users\fagner.batista\Documents\apiPdfLinux\node_modules\@babel\runtime\helpers\asyncToGenerator.js:21:12) at t._createClass.value (C:\Users\fagner.batista\Documents\apiPdfLinux\node_modules\pdf2pic\dist\index.min.js:1:6078) (node:8980) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:8980) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. (node:8980) UnhandledPromiseRejectionWarning: Error: Could not execute GraphicsMagick/ImageMagick: gm "identify" "-ping" "-format" "%p" "sample.pdf" this most likely means the gm/convert binaries can't be found at ChildProcess.<anonymous> (C:\Users\fagner.batista\Documents\apiPdfLinux\node_modules\gm\lib\command.js:232:12) at ChildProcess.emit (events.js:189:13) at ChildProcess.cp.emit (C:\Users\fagner.batista\Documents\apiPdfLinux\node_modules\cross-spawn\lib\enoent.js:36:37) at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12) (node:8980) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
yakovmeistercommented, Jun 30, 2019

@shimonbrandsdorfer I have updated the read me file. density can actually accept numerical value, size however accepts string.

0reactions
fafa1commented, Jul 9, 2019

Here worked very well without the ‘-1’. I used ‘for’ to iterate on each page of the pdf. I would like to know if the function returns the page number of the pdf, to use dynamically in the ‘for’. instead of using the number 6.

async function convertePdf () { for (let i = 1; i <= 6; i++) { await pdf2pic.convert(“sample.pdf”, [i]).then(resolve => { console.log(“image converter successfully!”)

  return resolve
}).catch(err => {
    console.log(err)
})
nomeFile = `converte_${i}.jpg`
listFile.push(nomeFile)
console.log(listFile)

}

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: split is not a function in JavaScript
The "split is not a function" error occurs when we call the split() method on a value that is not of type string....
Read more >
What is causing the error `string.split is not a function`?
This is because document.location is a Location object. The default .toString() returns the location in string form, so the concatenation will trigger that....
Read more >
How To Fix Split is Not a Function Error in JavaScript
split is not a function error. The Problem. First and foremost it is important to understand the usage of the split() method. It...
Read more >
[Solved] TypeError: split is not a function - ItsJavaScript
The TypeError: split is not a function occurs if we call a split() method on the value that is not of a type...
Read more >
Error: split is not a function - JavaScript
I have a string that is a latitude and longitude pair separated by a comma. I'm trying to separate the 2 parts of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found