chuckfairy / node-webcam

Nodejs Cross Platform Webcam usage
MIT License
194 stars 52 forks source link

Error in windows build - does not find bindings/CommandCam/CommandCam.exe #46

Open yonlif opened 4 years ago

yonlif commented 4 years ago

Hello, When building an app that uses your package the following error appears: WhatsApp Image 2020-05-20 at 00 44 30

This error actually makes a lot of sense, there is no build section in package.json and CommandCam.exe is not imported as part of the app to the production version of the app.

A good beginning (in my opinion) to fix this will be to add:

"build": {
  "files": [
    "src/bindings/"
  ]
}

And add a statements like the following to src/webcams/WindowsWebcam.js:

const command_cam_exe_path =
  process.env.NODE_ENV === 'production'
    ? `some path`
    : __dirname;

I would really like to use this package in a production version so please fix that,
Thanks!

chuckfairy commented 4 years ago

https://github.com/chuckfairy/node-webcam/blob/master/package.json#L8 Did this not run? Right now I've got it setup to download the file from github. I'd love to add a build section, however this isn't a gyp build it's just a pure CLI program. Would that still work for the build section?

https://github.com/chuckfairy/node-webcam/blob/master/bin/postinstall.js You want to run this and tell me if you get any errors?

chuckfairy commented 4 years ago

https://github.com/chuckfairy/node-webcam/commit/e1d0862efc62f85199a0d941f93443270ac423fa Looks like it's probably from a camel case issue. My git bash didn't care I guess on the case. Version 0.6.3 should fix it. I'll leave this open for a bit.

MadLittleMods commented 4 years ago

Still seeing this problem with v0.6.3 on Windows 10

some-project\node_modules\node-webcam\src\webcams\WindowsWebcam.js:98
        if( err ) { throw err; }
                    ^

Error: Command failed: "some-project\node_modules\node-webcam\src\bindings\CommandCam\CommandCam.exe" /devlist
This version of some-project\node_modules\node-webcam\src\bindings\CommandCam\CommandCam.exe is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher.

    at ChildProcess.exithandler (child_process.js:294:12)
    at ChildProcess.emit (events.js:189:13)
    at maybeClose (internal/child_process.js:970:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
MadLittleMods commented 4 years ago

If I try to run CommandCam.exe directly on Windows 10, I see an error Unsupported 16-bit Application

\some-project\\node_modules\node-webcam\src\bindings\CommandCam\CommandCam.exe ->