I wrote a demo to create screenshot by robotjs, find the location of a target button by opencv4nodejs and click it. As description above, robotjs, opencv4nodejs and node-ffi was used in this script. I also want to pack it as .exe file so we can distribute it and let other user run it without installing Node JS enviroment. I used pkg to create .exe file for this project and error occured when I run this .exe file:
internal/modules/cjs/loader.js:1206
return process.dlopen(module, path.toNamespacedPath(filename));
^
Error: The specified module could not be found.
\?\C:\...\Pkg\cache\example\node_modules\opencv4nodejs\build\Release\opencv4nodejs.node
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1206:18)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Module.require (internal/modules/cjs/loader.js:1042:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object. (E:\Project\web\Demo\open\node_modules\opencv4nodejs\lib\cv.js:58:8)
at Module._compile (internal/modules/cjs/loader.js:1156:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
Process finished with exit code 1
This script can be run perfectly in development environments. I am not sure what happenned. Please help me.
Environments: Node JS v10.x opencv4nodejs latest node-ffi latest robotjs latest