octalmage / robotjs

Node.js Desktop Automation.
http://robotjs.io
MIT License
12.4k stars 971 forks source link

Robotjs error with pkg #694

Open SKeeble89 opened 3 years ago

SKeeble89 commented 3 years ago

Expected Behavior

running pkg . should create an. exe of node/express application. ## Current Behavior

Pkg . creates faulty .exe, debug shows the following error with robotjs

[debug] prebuild-install failed[C:\Users\Documents\node_modules\robotjs\build\Release\robotjs.node ]: Error: spawnSync C:\npm\node_modules\pkg\node_modules.bin\prebuild-install ENOENT

Possible Solution

Steps to Reproduce (for bugs)

1.create a nodejs/express server app with an end point. 2.add robot js typeString("helloworld") and keyTap(Enter) 3.setup assets for pkg in package.json as error this stackoverflow question. 4.run pkg . --debug to see the build, create .exe and run in terminal to see call error on robotjs

Context

I want to create an. exe file of the project I have built.

I have created an express server that I can run pkg . on and create a stable .exe for my application. As soon as I introduce my call to robot js, I can run my application via the terminal using 'npm start' script with the exact behaviour that I expect from robotjs, but if I run pkg . with the calls to robotjs included the .exe fails to run with the errors shown above and in the stackoverflow question link.

Your Environment

activeliang commented 3 years ago

+1

subhanjanOps commented 2 years ago

+1

Jey0707 commented 2 years ago

I solved in this way:

Require this after requiring robotjs

require("./node_modules/robotjs/build/Release/robotjs.node")

I hope I have been helpful

SKeeble89 commented 2 years ago

@VitoFarella thank you so much! This worked perfectly :-)