nut-tree / nut.js

Native UI testing / controlling with node
https://nutjs.dev
2.21k stars 121 forks source link

NodeGUI and nut.js #231

Open peec opened 3 years ago

peec commented 3 years ago

Version next.

Short overview

Issue occurs on

Detailed error description

I am using https://github.com/nodegui/react-nodegui-starter as a starter. Dont use electron its too slow.

After npm installing nut.js, and starting it using nodegui react, i get this error ( libnut.node could not be found ).

➜  robot2 git:(master) ✗ npm run start                                   

> react-nodegui-starter@1.0.0 start
> qode ./dist/index.js

/Users/peec/Desktop/robot2/dist/index.js:28402
  throw err;
  ^

Error: Could not locate the bindings file. Tried:
 → /Users/peec/Desktop/robot2/build/libnut.node
 → /Users/peec/Desktop/robot2/build/Debug/libnut.node
 → /Users/peec/Desktop/robot2/build/Release/libnut.node
 → /Users/peec/Desktop/robot2/out/Debug/libnut.node
 → /Users/peec/Desktop/robot2/Debug/libnut.node
 → /Users/peec/Desktop/robot2/out/Release/libnut.node
 → /Users/peec/Desktop/robot2/Release/libnut.node
 → /Users/peec/Desktop/robot2/build/default/libnut.node
 → /Users/peec/Desktop/robot2/compiled/14.2.0/darwin/x64/libnut.node
 → /Users/peec/Desktop/robot2/addon-build/release/install-root/libnut.node
 → /Users/peec/Desktop/robot2/addon-build/debug/install-root/libnut.node
 → /Users/peec/Desktop/robot2/addon-build/default/install-root/libnut.node
 → /Users/peec/Desktop/robot2/lib/binding/node-v83-darwin-x64/libnut.node
    at bindings (/Users/peec/Desktop/robot2/dist/index.js:28393:9)
    at Object../node_modules/@nut-tree/libnut-darwin/index.js (/Users/peec/Desktop/robot2/dist/index.js:20923:90)
    at __webpack_require__ (/Users/peec/Desktop/robot2/dist/index.js:749:30)
    at fn (/Users/peec/Desktop/robot2/dist/index.js:60:20)
    at webpackContext (/Users/peec/Desktop/robot2/dist/index.js:20834:9)
    at Object../node_modules/@nut-tree/libnut/index.js (/Users/peec/Desktop/robot2/dist/index.js:24997:97)
    at __webpack_require__ (/Users/peec/Desktop/robot2/dist/index.js:749:30)
    at fn (/Users/peec/Desktop/robot2/dist/index.js:60:20)
    at Object../node_modules/@nut-tree/nut-js/dist/lib/provider/native/libnut-keyboard-action.class.js (/Users/peec/Desktop/robot2/dist/index.js:26485:16)
    at __webpack_require__ (/Users/peec/Desktop/robot2/dist/index.js:749:30) {
  tries: [
    '/Users/peec/Desktop/robot2/build/libnut.node',
    '/Users/peec/Desktop/robot2/build/Debug/libnut.node',
    '/Users/peec/Desktop/robot2/build/Release/libnut.node',
    '/Users/peec/Desktop/robot2/out/Debug/libnut.node',
    '/Users/peec/Desktop/robot2/Debug/libnut.node',
    '/Users/peec/Desktop/robot2/out/Release/libnut.node',
    '/Users/peec/Desktop/robot2/Release/libnut.node',
    '/Users/peec/Desktop/robot2/build/default/libnut.node',
    '/Users/peec/Desktop/robot2/compiled/14.2.0/darwin/x64/libnut.node',
    '/Users/peec/Desktop/robot2/addon-build/release/install-root/libnut.node',
    '/Users/peec/Desktop/robot2/addon-build/debug/install-root/libnut.node',
    '/Users/peec/Desktop/robot2/addon-build/default/install-root/libnut.node',
    '/Users/peec/Desktop/robot2/lib/binding/node-v83-darwin-x64/libnut.node'
  ]
}

Steps to reproduce error

Additional content

Please provide any (mandatory) additional data to reproduce the error (Dockerfiles etc.)

package.json

{
  "name": "react-nodegui-starter",
  "version": "1.0.0",
  "main": "index.js",
  "author": "Atul R <atulanand94@gmail.com>",
  "license": "MIT",
  "private": true,
  "scripts": {
    "build": "webpack -p",
    "dev": "webpack --mode=development",
    "start": "qode ./dist/index.js",
    "debug": "qode --inspect ./dist/index.js",
    "rebuild": "npm rebuild --node-dir=node_modules/@nodegui/qode"
  },
  "dependencies": {
    "@nodegui/react-nodegui": "^0.10.2",
    "@nut-tree/nut-js": "^1.6.1-next.20210408195718",
    "open": "^7.2.1",
    "react": "^16.13.1",
    "robotjs": "^0.6.0"
  },
  "devDependencies": {
    "@babel/core": "^7.11.6",
    "@babel/preset-env": "^7.11.5",
    "@babel/preset-react": "^7.10.4",
    "@babel/preset-typescript": "^7.10.4",
    "@nodegui/packer": "^1.4.1",
    "@types/node": "^14.11.1",
    "@types/react": "^16.9.49",
    "@types/webpack-env": "^1.15.3",
    "babel-loader": "^8.1.0",
    "clean-webpack-plugin": "^3.0.0",
    "file-loader": "^6.1.0",
    "fork-ts-checker-webpack-plugin": "^5.2.0",
    "native-addon-loader": "^2.0.1",
    "typescript": "^4.0.3",
    "webpack": "^4.44.2",
    "webpack-cli": "^3.3.12"
  }
}
s1hofmann commented 3 years ago

Hi @peec 👋

I have no experience with nodeGUI, I’ll have to check it out first. I’ll let you know when I find anything suspicious on this issue.

Best regards

Simon

peec commented 3 years ago

Hi @s1hofmann , Thank you,

Here are some info on that it should support native modules ( i got robotjs to build as part of the project ):

https://react.nodegui.org/docs/guides/using-native-node-modules

peec commented 3 years ago

@s1hofmann I might have found something, it seems that the "bindings" library causes this (which is used in nut.js).

I fixed my own fork of another library, by removing the bindings lib, and just require the .node manually:

https://github.com/peec/node-app-nap/commit/18adf165af072cbee592251f3094bb1520aac975#diff-dcbf96cea4e9a01f452bf8327b4e0b8955b79c866c5250bf6ec8279b71638852R1

Also the "bindings" library has this issue, but the "bindings" library seems not to be maintained anymore

https://github.com/TooTallNate/node-bindings/pull/68

github-actions[bot] commented 2 years ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 2 years ago

This issue was closed because it has been inactive for 14 days since being marked as stale.