Description
Version
- Node.js Version 20.6.0
- npm Version 10.0.0
- Windows Version 10.0.19044.3086
Short overview
Cannot use screen.find featrue because I cannot install dependency "@nut-tree/opencv-build".
Issue occurs on
local machine
- Virtual machine
- Docker container
- Dev/Host system
Detailed error description
- I was attempting to use the screen.find(imageResource())-feature, but it requires OpenCV. Every attempt to install it via npm or manually by copying files failed.
- On the GitHub page of OpenCV, I found out, I need cmake. so I installed cmake and again attempted to install OpenCV but without success.
- I also found on another page that i probably need the MS Media Feature Pack, so downloaded it, but installation failed.
- So in summary ... mouse and keyboard control are quite nice, but the interesting things begin with screen finding. But it won't work, so at the moment, NutJS for me is just a small, not really usable toy.
- Can you fix this issue or help me, what to do?
Steps to reproduce error
- already installed nodejs and npm (latest version)
- installed nutjs via npm and according to installation guide on nutjs website
- using the folling code sniplets:
import * as NutJS from "@nut-tree/nut-js";
import "@nut-tree/template-matcher";
result = await NutJS.screen.find(NutJS.imageResource("../assets/images/async.png")); - then i get error message (siee additional content)
Additional content
C:\Users\RobertST\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:859
return new TSError(diagnosticText, diagnosticCodes, diagnostics);
^
TSError: ⨯ Unable to compile TypeScript:
src/tempCodeRunnerFile.ts(1,1): error TS2304: Cannot find name 'result'.
src/tempCodeRunnerFile.ts(1,10): error TS1375: 'await' expressions are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module.
src/tempCodeRunnerFile.ts(1,10): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
src/tempCodeRunnerFile.ts(1,16): error TS2304: Cannot find name 'NutJS'.
src/tempCodeRunnerFile.ts(1,34): error TS2304: Cannot find name 'NutJS'.
at createTSError (C:\Users\RobertST\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:859:12)
at reportTSError (C:\Users\RobertST\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:863:19)
at getOutput (C:\Users\RobertST\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1077:36)
at Object.compile (C:\Users\RobertST\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1433:41)
at Module.m._compile (C:\Users\RobertST\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1617:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
at Object.require.extensions.<computed> [as .ts] (C:\Users\RobertST\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:1091:32)
at Function.Module._load (node:internal/modules/cjs/loader:938:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12) {
diagnosticCodes: [ 2304, 1375, 1378, 2304, 2304 ]
}