robot-js
robot-js copied to clipboard
Couldn't install via npm on win x64
I ran this:
digit@mighty-dev MINGW64 ~/Desktop/workspace/proj (suhail/events)
$ npm install robot-js
Error:
npm WARN deprecated [email protected]: This module moved to @hapi/hawk. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
npm WARN deprecated [email protected]: This module moved to @hapi/sntp. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
npm WARN deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
> [email protected] install C:\Users\digit\Desktop\workspace\proj\node_modules\robot-js
> node scripts/install.js || node-gyp rebuild
At line:1 char:25
+ node scripts/install.js || node-gyp rebuild
+ ~~
The token '||' is not a valid statement separator in this version.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : InvalidEndOfLine
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node scripts/install.js || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\digit\AppData\Roaming\npm-cache\_logs\2019-06-05T19_55_41_932Z-debug.log
Env
- $ npm --version = 6.9.0
- $ node --version = v11.11.0
- OS Version: 10.0.17763 N/A Build 17763
- Powershell version: $PSVersionTable.PSVersion = 5.1
Update:
When I got rid of the || since powershell doesn't support that and just tried to npm install locally. Effectively, it's now running node-gyp rebuild
since there's no pre-built I imagine for Node 12.x.
Building in VS17 went fine & succeeded.
I began to get these errors as well:
[Compiling...]
NodeRobot.cc
NodeImage.cc
NodeKeyboard.cc
NodeMouse.cc
NodeProcess.cc
NodeMemory.cc
NodeWindow.cc
NodeScreen.cc
c:\users\digit\desktop\workspace\proj\node_modules\robot-js\src\nodeimage.cc(112): error C2661: 'v8::Function::NewInstance': no overloaded function takes 2 arguments [C:\Users\digit\Desktop\workspace\cl
oudbox\node_modules\robot-js\build\win32-x64-67.vcxproj]
c:\users\digit\desktop\workspace\proj\node_modules\robot-js\src\nodeimage.cc(204): error C2661: 'v8::Function::NewInstance': no overloaded function takes 2 arguments [C:\Users\digit\Desktop\workspace\cl
oudbox\node_modules\robot-js\build\win32-x64-67.vcxproj]
c:\users\digit\desktop\workspace\proj\node_modules\robot-js\src\nodeimage.cc(209): error C3536: 's': cannot be used before it is initialized [C:\Users\digit\Desktop\workspace\proj\node_modules\robot
-js\build\win32-x64-67.vcxproj]
c:\users\digit\desktop\workspace\proj\node_modules\robot-js\src\nodeimage.cc(221): error C2661: 'v8::Function::NewInstance': no overloaded function takes 2 arguments [C:\Users\digit\Desktop\workspace\cl
oudbox\node_modules\robot-js\build\win32-x64-67.vcxproj]
It seems related to my node version. I want to compile it to use Node 12.x. I noticed the docs are outdated and mentioned some UserMacro -> NodeVersion I could change but I couldn't find that anywhere.
Node 12 has some changes in the ABI, which were breaking builds. I've opened a #74 with some fixes which ought to get node-gyp working again. Alternately, you can run from my prebuilt fork by specifying "robot-js": "github:p120ph37/robot-js#prebuilt"
in your package.json
.
I use with Node 10, still get the same error.
EDIT: Where should I put fork in package.json?
@kkm Put it inside the dependencies and replace it with the robot-js module. Node 12 is still not supported, we have to merge a PR into master and release the prebuilt binaries. Let's see if @dkrutsko can do it soon 😄
This works as of 7/27/2020
// package.json
{
"name": "robot-js-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"robot-js": "github:p120ph37/robot-js#prebuilt"
},
"keywords": [],
"author": "",
"license": "ISC"
}
Used yarn install after adding "robot-js": "github:p120ph37/robot-js#prebuilt" to the dependencies.
// index.js
// Node
var robot = require ("robot-js");
// Must be true in order to work
if (robot.Window.isAxEnabled()) {
var list = robot.Window.getList (".*");
// List is an array
list.forEach((w) => {
console.log(w.getTitle())
; // Always contains "title"
});
}
Yeah, I updated my fork and prebuilt binaries a couple weeks ago. Should work up to Node 14 and Electron 9. I'm waiting for Electron 10 to come out of beta before adding it to the prebuilt list, but so far it looks like it ought to be possible without any additional tweaks to the source.