nathanpeck / exiftool

A Node.js wrapper around exiftool, providing metadata extraction from numerous audio, video, document, and binary filetypes
MIT License
81 stars 26 forks source link

Breaking errors: EPIPE/ENOENT #23

Closed paddotk closed 4 years ago

paddotk commented 4 years ago

I'm trying to get exiftool working in my Electron app, but simply running the demo code as provided on exiftool's main Github page breaks the application with some vague errors.

Error: write EPIPE on line 82 in exiftool.js. (exif.stdin.write(source);). In the JS console I see the error Uncaught Error: spawn exiftool ENOENT which refers to child_process.

I should mention that before this, I had an error stating that child_process.spawn is not a function. To resolve this, I copied exiftool.js to my project's src directory and changed var ChildProcess = require('child_process'); to var ChildProcess = window.require('child_process'); to get it to load child_process properly. When I debug, the var ChildProcess does indeed seem to contain all the right stuff, including the spawn function. I also had to prepend window. to the fs import to make that work so I guess that should be fine..

Any ideas on what's happening?

paddotk commented 4 years ago

I figured out what went wrong. The tool that this library uses wasn't found, because dummy me missed a step in the installation; renaming it (I don't read so well, seemingly 😛)

For others facing the same issue, you can get the (non-perl) standalone version, put the unzipped exiftool(-k).exe file in C:/Windows (assuming you're on Windows of course) and rename it to exiftool.exe.

That said, I think it would be a good idea to implement error handling upon failing to find the exiftool, so that an error can clarify what went wrong; in this case, the tool not being found.