Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Couldn't install via npm on win x64 #73

Open
Suhail opened this issue Jun 5, 2019 · 6 comments
Open

Couldn't install via npm on win x64 #73

Suhail opened this issue Jun 5, 2019 · 6 comments

Comments

@Suhail
Copy link

Suhail commented Jun 5, 2019

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
@Suhail Suhail changed the title Couldn't install via npm Couldn't install via npm on win x64 Jun 5, 2019
@Suhail
Copy link
Author

Suhail commented Jun 5, 2019

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.

@p120ph37
Copy link

p120ph37 commented Oct 9, 2019

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.

@kkm
Copy link

kkm commented Nov 25, 2019

I use with Node 10, still get the same error.

EDIT: Where should I put fork in package.json?

@karliky
Copy link
Member

karliky commented Nov 26, 2019

@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 😄

@MichaelLeeHobbs
Copy link

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"
    });
}

@p120ph37
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants