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

Install of template-matcher fails on windows 10 #358

Closed
1 task done
kokarn opened this issue Jan 7, 2022 · 15 comments
Closed
1 task done

Install of template-matcher fails on windows 10 #358

kokarn opened this issue Jan 7, 2022 · 15 comments

Comments

@kokarn
Copy link

kokarn commented Jan 7, 2022

Version
2.0.0

Short overview
It fails
Issue occurs on

  • Dev/Host system

Detailed error description

C:\Users\nuc\Documents\GitHub\test-project>npm i @nut-tree/nut-js
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated uuid@3.0.1: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! code 1
npm ERR! path C:\Users\nuc\Documents\GitHub\test-project\node_modules\opencv4nodejs-prebuilt
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c prebuild-install || (node ./install/dependencies.js && node ./install/install.js)
npm ERR! Installing prebuilt OpenCV vundefined for plattform win32
npm ERR! prebuild-install WARN install The specified module could not be found.
npm ERR! prebuild-install WARN install \\?\C:\Users\nuc\Documents\GitHub\test-project\node_modules\opencv4nodejs-prebuilt\build\Release\opencv4nodejs.node
npm ERR! npm ERR! code ETARGET
npm ERR! npm ERR! notarget No matching version found for @nut-tree/opencv-build-win32@undefined.
npm ERR! npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! npm ERR! notarget a package version that doesn't exist.
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR!     C:\Users\nuc\AppData\Local\npm-cache\_logs\2022-01-07T15_36_23_564Z-debug-0.log
npm ERR! node:child_process:903
npm ERR!     throw err;
npm ERR!     ^
npm ERR!
npm ERR! Error: Command failed: npm install --no-save @nut-tree/opencv-build-win32@undefined
npm ERR! npm ERR! code ETARGET
npm ERR! npm ERR! notarget No matching version found for @nut-tree/opencv-build-win32@undefined.
npm ERR! npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! npm ERR! notarget a package version that doesn't exist.
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR!     C:\Users\nuc\AppData\Local\npm-cache\_logs\2022-01-07T15_36_23_564Z-debug-0.log
npm ERR!
npm ERR!     at checkExecSyncError (node:child_process:826:11)
npm ERR!     at execSync (node:child_process:900:15)
npm ERR!     at install (C:\Users\nuc\Documents\GitHub\test-project\node_modules\opencv4nodejs-prebuilt\install\dependencies.js:5:5)
npm ERR!     at Object.<anonymous> (C:\Users\nuc\Documents\GitHub\test-project\node_modules\opencv4nodejs-prebuilt\install\dependencies.js:26:5)
npm ERR!     at Module._compile (node:internal/modules/cjs/loader:1101:14)
npm ERR!     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
npm ERR!     at Module.load (node:internal/modules/cjs/loader:981:32)
npm ERR!     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
npm ERR!     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
npm ERR!     at node:internal/main/run_main_module:17:47 {
npm ERR!   status: 1,
npm ERR!   signal: null,
npm ERR!   output: [
npm ERR!     null,
npm ERR!     Buffer(0) [Uint8Array] [],
npm ERR!     Buffer(392) [Uint8Array] [
npm ERR!       110, 112, 109,  32,  69,  82,  82,  33,  32,  99, 111, 100,
npm ERR!       101,  32,  69,  84,  65,  82,  71,  69,  84,  10, 110, 112,
npm ERR!       109,  32,  69,  82,  82,  33,  32, 110, 111, 116,  97, 114,
npm ERR!       103, 101, 116,  32,  78, 111,  32, 109,  97, 116,  99, 104,
npm ERR!       105, 110, 103,  32, 118, 101, 114, 115, 105, 111, 110,  32,
npm ERR!       102, 111, 117, 110, 100,  32, 102, 111, 114,  32,  64, 110,
npm ERR!       117, 116,  45, 116, 114, 101, 101,  47, 111, 112, 101, 110,
npm ERR!        99, 118,  45,  98, 117, 105, 108, 100,  45, 119, 105, 110,
npm ERR!        51,  50,  64, 117,
npm ERR!       ... 292 more items
npm ERR!     ]
npm ERR!   ],
npm ERR!   pid: 7232,
npm ERR!   stdout: Buffer(0) [Uint8Array] [],
npm ERR!   stderr: Buffer(392) [Uint8Array] [
npm ERR!     110, 112, 109,  32,  69,  82,  82,  33,  32,  99, 111, 100,
npm ERR!     101,  32,  69,  84,  65,  82,  71,  69,  84,  10, 110, 112,
npm ERR!     109,  32,  69,  82,  82,  33,  32, 110, 111, 116,  97, 114,
npm ERR!     103, 101, 116,  32,  78, 111,  32, 109,  97, 116,  99, 104,
npm ERR!     105, 110, 103,  32, 118, 101, 114, 115, 105, 111, 110,  32,
npm ERR!     102, 111, 117, 110, 100,  32, 102, 111, 114,  32,  64, 110,
npm ERR!     117, 116,  45, 116, 114, 101, 101,  47, 111, 112, 101, 110,
npm ERR!      99, 118,  45,  98, 117, 105, 108, 100,  45, 119, 105, 110,
npm ERR!      51,  50,  64, 117,
npm ERR!     ... 292 more items
npm ERR!   ]
npm ERR! }

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\nuc\AppData\Local\npm-cache\_logs\2022-01-07T15_32_52_489Z-debug-0.log

C:\Users\nuc\Documents\GitHub\test-project>node -v
v16.13.1

Steps to reproduce error
npm i @nut-tree/nut-js

@s1hofmann
Copy link
Member

Hi @kokarn 👋

To be honest, this looks odd.
nut.js 2.0.0 no longer depends on opencv4nodejs-prebuilt, so I'm wondering how it ends up in your build?

@kokarn
Copy link
Author

kokarn commented Jan 7, 2022

Hello!

So it seems I might have posted in the wrong place (ish).
It's template matcher that installs it and I was running in a non-empty directory.

However, the exact same error is thrown with npm i @nut-tree/template-matcher

@kokarn kokarn changed the title Install fails on windows 10 Install of template-matcher fails on windows 10 Jan 7, 2022
@s1hofmann
Copy link
Member

Looks like the npm config setting is not properly picked up with npm 8.x.x.

Can you try to manually set the right config via environment variable: npm_package_config_opencv=4.1.1-7?

@kokarn
Copy link
Author

kokarn commented Jan 8, 2022

Nice find! That worked!

C:\Users\nuc\Documents\GitHub\my-project>set npm_package_config_opencv=4.1.1-7

C:\Users\nuc\Documents\GitHub\my-project>npm i @nut-tree/template-matcher
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142

added 281 packages, and audited 282 packages in 1m

10 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Probably also solves #328 if fixed 👍

@kokarn
Copy link
Author

kokarn commented Jan 8, 2022

I might have spoken too soon. Tried installing in another project that actually uses it and it results in this

C:\Users\nuc\Documents\GitHub\nut-project\node_modules\opencv4nodejs-prebuilt\lib\cv.js:14
  throw err
  ^

Error: Cannot find module 'C:\Users\nuc\Documents\GitHub\nut-project\node_modules\opencv4nodejs-prebuilt\build\Release\opencv4nodejs'
Require stack:
- C:\Users\nuc\Documents\GitHub\nut-project\node_modules\opencv4nodejs-prebuilt\lib\cv.js
- C:\Users\nuc\Documents\GitHub\nut-project\node_modules\opencv4nodejs-prebuilt\lib\opencv4nodejs.js
- C:\Users\nuc\Documents\GitHub\nut-project\node_modules\@nut-tree\template-matcher\dist\lib\match-image.function.js
- C:\Users\nuc\Documents\GitHub\nut-project\node_modules\@nut-tree\template-matcher\dist\lib\template-matching-finder.class.js
- C:\Users\nuc\Documents\GitHub\nut-project\node_modules\@nut-tree\template-matcher\dist\index.js
- C:\Users\nuc\Documents\GitHub\nut-project\modules\screen.js
- C:\Users\nuc\Documents\GitHub\nut-project\modules\handle-image.js
- C:\Users\nuc\Documents\GitHub\nut-project\index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Users\nuc\Documents\GitHub\nut-project\node_modules\opencv4nodejs-prebuilt\lib\cv.js:11:8)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\nuc\\Documents\\GitHub\\nut-project\\node_modules\\opencv4nodejs-prebuilt\\lib\\cv.js',
    'C:\\Users\\nuc\\Documents\\GitHub\\nut-project\\node_modules\\opencv4nodejs-prebuilt\\lib\\opencv4nodejs.js',
    'C:\\Users\\nuc\\Documents\\GitHub\\nut-project\\node_modules\\@nut-tree\\template-matcher\\dist\\lib\\match-image.function.js',
    'C:\\Users\\nuc\\Documents\\GitHub\\nut-project\\node_modules\\@nut-tree\\template-matcher\\dist\\lib\\template-matching-finder.class.js',
    'C:\\Users\\nuc\\Documents\\GitHub\\nut-project\\node_modules\\@nut-tree\\template-matcher\\dist\\index.js',
    'C:\\Users\\nuc\\Documents\\GitHub\\nut-project\\modules\\screen.js',
    'C:\\Users\\nuc\\Documents\\GitHub\\nut-project\\modules\\handle-image.js',
    'C:\\Users\\nuc\\Documents\\GitHub\\nut-project\\index.js'
  ]
}

@kokarn
Copy link
Author

kokarn commented Jan 8, 2022

Did some more digging for you. Not sure what's up with my system really :D
npm 7 fails in the same way 8 does.
npm 6 succeeds with installation but tries to build (even tho I don't think it should?) and fails to build because I don't have python which makes half-sense I guess?

Installing python now to see what that will result in

C:\Users\nuc\Documents\GitHub\nut-project>npm i
npm WARN deprecated uuid@3.0.1: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.

> opencv4nodejs-prebuilt@5.3.3 install C:\Users\nuc\Documents\GitHub\nut-project\node_modules\opencv4nodejs-prebuilt
> prebuild-install || (node ./install/dependencies.js && node ./install/install.js)

prebuild-install WARN install The specified module could not be found.
prebuild-install WARN install \\?\C:\Users\nuc\Documents\GitHub\nut-project\node_modules\opencv4nodejs-prebuilt\build\Release\opencv4nodejs.node
Installing prebuilt OpenCV v4.1.1-7 for plattform win32
npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
info the following opencv4nodejs environment variables are set in the package.json:
info disableAutoBuild: 1
info install OPENCV4NODEJS_DISABLE_AUTOBUILD is set
info install skipping auto build...
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^2.1.2 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

Done.
info install using lib dir: C:/Users/nuc/Documents/GitHub/nut-project/node_modules/opencv4nodejs-prebuilt/node_modules/@nut-tree/opencv-build-win32/opencv/build/lib/Release
info install found the following libs:
info install world : C:\Users\nuc\Documents\GitHub\nut-project\node_modules\opencv4nodejs-prebuilt\node_modules\@nut-tree\opencv-build-win32\opencv\build\lib\Release\opencv_world411.lib

info install setting the following defines:
info defines OPENCV4NODEJS_FOUND_LIBRARY_WORLD

info install setting the following includes:
info includes C:/Users/nuc/Documents/GitHub/nut-project/node_modules/opencv4nodejs-prebuilt/node_modules/@nut-tree/opencv-build-win32/opencv/build/include
info includes C:/Users/nuc/Documents/GitHub/nut-project/node_modules/opencv4nodejs-prebuilt/node_modules/@nut-tree/opencv-build-win32/opencv/build/include/opencv4

info install setting the following libs:
info libs C:/Users/nuc/Documents/GitHub/nut-project/node_modules/opencv4nodejs-prebuilt/node_modules/@nut-tree/opencv-build-win32/opencv/build/lib/Release/opencv_world411.lib
info install spawning process: npm run rebuild

> opencv4nodejs-prebuilt@5.3.3 rebuild C:\Users\nuc\Documents\GitHub\nut-project\node_modules\opencv4nodejs-prebuilt
> node ./install/dependencies.js && node-gyp rebuild --jobs max

Installing prebuilt OpenCV v4.1.1-7 for plattform win32
npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
info the following opencv4nodejs environment variables are set in the package.json:
info disableAutoBuild: 1
info install OPENCV4NODEJS_DISABLE_AUTOBUILD is set
info install skipping auto build...
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^2.1.2 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

Done.

C:\Users\nuc\Documents\GitHub\nut-project\node_modules\opencv4nodejs-prebuilt>if not defined npm_config_node_gyp (node "C:\Users\nuc\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild --jobs max )  else (node "C:\Users\nuc\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild --jobs max )
gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python" can be used
gyp ERR! find Python - "python" is not in PATH or produced an error
gyp ERR! find Python checking if "python2" can be used
gyp ERR! find Python - "python2" is not in PATH or produced an error
gyp ERR! find Python checking if "python3" can be used
gyp ERR! find Python - "python3" is not in PATH or produced an error
gyp ERR! find Python checking if the py launcher can be used to find Python 2
gyp ERR! find Python - "py.exe" is not in PATH or produced an error
gyp ERR! find Python checking if Python is C:\Python27\python.exe
gyp ERR! find Python - "C:\Python27\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Python37\python.exe
gyp ERR! find Python - "C:\Python37\python.exe" could not be run
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe"
gyp ERR! find Python   (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python   npm config set python "C:\Path\To\python.exe"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack     at PythonFinder.fail (C:\Users\nuc\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-python.js:307:47)
gyp ERR! stack     at PythonFinder.runChecks (C:\Users\nuc\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-python.js:136:21)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\Users\nuc\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-python.js:225:16)
gyp ERR! stack     at PythonFinder.execFileCallback (C:\Users\nuc\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-python.js:271:16)
gyp ERR! stack     at exithandler (node:child_process:404:5)
gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:416:5)
gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
gyp ERR! stack     at onErrorNT (node:internal/child_process:477:16)
gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:83:21)
gyp ERR! System Windows_NT 10.0.19044
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\nuc\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--jobs" "max"
gyp ERR! cwd C:\Users\nuc\Documents\GitHub\nut-project\node_modules\opencv4nodejs-prebuilt
gyp ERR! node -v v16.13.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! opencv4nodejs-prebuilt@5.3.3 rebuild: `node ./install/dependencies.js && node-gyp rebuild --jobs max`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the opencv4nodejs-prebuilt@5.3.3 rebuild 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\nuc\AppData\Roaming\npm-cache\_logs\2022-01-08T10_55_09_138Z-debug.log
ERR! Error: Command failed: npm run rebuild
npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
info the following opencv4nodejs environment variables are set in the package.json:
info disableAutoBuild: 1
info install OPENCV4NODEJS_DISABLE_AUTOBUILD is set
info install skipping auto build...
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^2.1.2 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python" can be used
gyp ERR! find Python - "python" is not in PATH or produced an error
gyp ERR! find Python checking if "python2" can be used
gyp ERR! find Python - "python2" is not in PATH or produced an error
gyp ERR! find Python checking if "python3" can be used
gyp ERR! find Python - "python3" is not in PATH or produced an error
gyp ERR! find Python checking if the py launcher can be used to find Python 2
gyp ERR! find Python - "py.exe" is not in PATH or produced an error
gyp ERR! find Python checking if Python is C:\Python27\python.exe
gyp ERR! find Python - "C:\Python27\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Python37\python.exe
gyp ERR! find Python - "C:\Python37\python.exe" could not be run
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe"
gyp ERR! find Python   (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python   npm config set python "C:\Path\To\python.exe"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack     at PythonFinder.fail (C:\Users\nuc\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-python.js:307:47)
gyp ERR! stack     at PythonFinder.runChecks (C:\Users\nuc\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-python.js:136:21)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\Users\nuc\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-python.js:225:16)
gyp ERR! stack     at PythonFinder.execFileCallback (C:\Users\nuc\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-python.js:271:16)
gyp ERR! stack     at exithandler (node:child_process:404:5)
gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:416:5)
gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
gyp ERR! stack     at onErrorNT (node:internal/child_process:477:16)
gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:83:21)
gyp ERR! System Windows_NT 10.0.19044
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\nuc\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--jobs" "max"
gyp ERR! cwd C:\Users\nuc\Documents\GitHub\nut-project\node_modules\opencv4nodejs-prebuilt
gyp ERR! node -v v16.13.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! opencv4nodejs-prebuilt@5.3.3 rebuild: `node ./install/dependencies.js && node-gyp rebuild --jobs max`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the opencv4nodejs-prebuilt@5.3.3 rebuild 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\nuc\AppData\Roaming\npm-cache\_logs\2022-01-08T10_55_09_138Z-debug.log


> tesseract.js@2.1.5 postinstall C:\Users\nuc\Documents\GitHub\nut-project\node_modules\tesseract.js
> opencollective-postinstall || true

Thank you for using tesseract.js!
If you rely on this package, please consider supporting our open collective:
> https://opencollective.com/tesseractjs/donate


> nut-project@4.2.1 postinstall C:\Users\nuc\Documents\GitHub\nut-project
> shx cp assets/spawnWorker.js node_modules/tesseract.js/src/worker/node/spawnWorker.js

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN notsup Unsupported engine for discord.js@13.5.1: wanted: {"node":">=16.6.0","npm":">=7.0.0"} (current: {"node":"16.13.1","npm":"6.14.15"})
npm WARN notsup Not compatible with your version of node/npm: discord.js@13.5.1
npm WARN notsup Unsupported engine for @discordjs/collection@0.4.0: wanted: {"node":">=16.0.0","npm":">=7.0.0"} (current: {"node":"16.13.1","npm":"6.14.15"})
npm WARN notsup Not compatible with your version of node/npm: @discordjs/collection@0.4.0
npm WARN notsup Unsupported engine for @discordjs/builders@0.11.0: wanted: {"node":">=16.0.0","npm":">=7.0.0"} (current: {"node":"16.13.1","npm":"6.14.15"})
npm WARN notsup Not compatible with your version of node/npm: @discordjs/builders@0.11.0
npm WARN notsup Unsupported engine for @sapphire/async-queue@1.1.9: wanted: {"node":">=v14.0.0","npm":">=7.0.0"} (current: {"node":"16.13.1","npm":"6.14.15"})
npm WARN notsup Not compatible with your version of node/npm: @sapphire/async-queue@1.1.9
npm WARN @aws-sdk/middleware-sdk-s3@3.46.0 requires a peer of @aws-sdk/signature-v4-crt@^3.31.0 but none is installed. You must install peer dependencies yourself.
npm WARN nut-project@4.2.1 No repository field.

added 621 packages from 522 contributors and audited 624 packages in 111.841s

45 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

@kokarn
Copy link
Author

kokarn commented Jan 8, 2022

Hate to break it, but seems even stranger when I manage to build myself.
It builds, add the file to the correct path (C:\Users\nuc\Documents\GitHub\nut-project\node_modules\opencv4nodejs-prebuilt\build\Release\opencv4nodejs.node) and then fails to load it?

C:\Users\nuc\Documents\GitHub\nut-project\node_modules\opencv4nodejs-prebuilt\lib\cv.js:14
  throw err
  ^

Error: The specified module could not be found.
\\?\C:\Users\nuc\Documents\GitHub\nut-project\node_modules\opencv4nodejs-prebuilt\build\Release\opencv4nodejs.node
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1183:18)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Users\nuc\Documents\GitHub\nut-project\node_modules\opencv4nodejs-prebuilt\lib\cv.js:11:8)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
  code: 'ERR_DLOPEN_FAILED'
}

@s1hofmann
Copy link
Member

Could you please start a fresh and empty npm project on node 16.13.1 and run

npm i @nut-tree/nut-js
npm i @nut-tree/template-matcher

and tell me the output?

Because:

@kokarn
Copy link
Author

kokarn commented Jan 8, 2022

I will give you that output ASAP, but here's a summary to help out

npm 7 & npm 8

  • Install fails on npm 7 & npm 8 by default
  • Install succeeds on npm 7 & npm 8 with npm_package_config_opencv=4.1.1-7 but the package isn't actually installed.
    • Doing a simple require leads to MODULE_NOT_FOUND

npm 6

  • Install tries to build.
    • No matter if the build itself succeeds or fails the install command returns success.
    • Even if the build succeeds it fails to load even with a simple require resulting in ERR_DLOPEN_FAILED

EDIT: Also, yes I have installed the Microsoft Visual C++ Redistributable :)

@kokarn
Copy link
Author

kokarn commented Jan 8, 2022

C:\Users\nuc\Documents\GitHub>mkdir new-project

C:\Users\nuc\Documents\GitHub>cd new-project

C:\Users\nuc\Documents\GitHub\new-project>npm i @nut-tree/nut-js
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142

added 238 packages, and audited 239 packages in 21s

8 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

C:\Users\nuc\Documents\GitHub\new-project>npm i @nut-tree/template-matcher
npm ERR! code 1
npm ERR! path C:\Users\nuc\Documents\GitHub\new-project\node_modules\opencv4nodejs-prebuilt
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c prebuild-install || (node ./install/dependencies.js && node ./install/install.js)
npm ERR! Installing prebuilt OpenCV vundefined for plattform win32
npm ERR! prebuild-install WARN install The specified module could not be found.
npm ERR! prebuild-install WARN install \\?\C:\Users\nuc\Documents\GitHub\new-project\node_modules\opencv4nodejs-prebuilt\build\Release\opencv4nodejs.node
npm ERR! npm ERR! code ETARGET
npm ERR! npm ERR! notarget No matching version found for @nut-tree/opencv-build-win32@undefined.
npm ERR! npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! npm ERR! notarget a package version that doesn't exist.
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR!     C:\Users\nuc\AppData\Local\npm-cache\_logs\2022-01-08T12_24_33_710Z-debug-0.log
npm ERR! node:child_process:903
npm ERR!     throw err;
npm ERR!     ^
npm ERR!
npm ERR! Error: Command failed: npm install --no-save @nut-tree/opencv-build-win32@undefined
npm ERR! npm ERR! code ETARGET
npm ERR! npm ERR! notarget No matching version found for @nut-tree/opencv-build-win32@undefined.
npm ERR! npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! npm ERR! notarget a package version that doesn't exist.
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR!     C:\Users\nuc\AppData\Local\npm-cache\_logs\2022-01-08T12_24_33_710Z-debug-0.log
npm ERR!
npm ERR!     at checkExecSyncError (node:child_process:826:11)
npm ERR!     at execSync (node:child_process:900:15)
npm ERR!     at install (C:\Users\nuc\Documents\GitHub\new-project\node_modules\opencv4nodejs-prebuilt\install\dependencies.js:5:5)
npm ERR!     at Object.<anonymous> (C:\Users\nuc\Documents\GitHub\new-project\node_modules\opencv4nodejs-prebuilt\install\dependencies.js:26:5)
npm ERR!     at Module._compile (node:internal/modules/cjs/loader:1101:14)
npm ERR!     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
npm ERR!     at Module.load (node:internal/modules/cjs/loader:981:32)
npm ERR!     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
npm ERR!     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
npm ERR!     at node:internal/main/run_main_module:17:47 {
npm ERR!   status: 1,
npm ERR!   signal: null,
npm ERR!   output: [
npm ERR!     null,
npm ERR!     Buffer(0) [Uint8Array] [],
npm ERR!     Buffer(392) [Uint8Array] [
npm ERR!       110, 112, 109,  32,  69,  82,  82,  33,  32,  99, 111, 100,
npm ERR!       101,  32,  69,  84,  65,  82,  71,  69,  84,  10, 110, 112,
npm ERR!       109,  32,  69,  82,  82,  33,  32, 110, 111, 116,  97, 114,
npm ERR!       103, 101, 116,  32,  78, 111,  32, 109,  97, 116,  99, 104,
npm ERR!       105, 110, 103,  32, 118, 101, 114, 115, 105, 111, 110,  32,
npm ERR!       102, 111, 117, 110, 100,  32, 102, 111, 114,  32,  64, 110,
npm ERR!       117, 116,  45, 116, 114, 101, 101,  47, 111, 112, 101, 110,
npm ERR!        99, 118,  45,  98, 117, 105, 108, 100,  45, 119, 105, 110,
npm ERR!        51,  50,  64, 117,
npm ERR!       ... 292 more items
npm ERR!     ]
npm ERR!   ],
npm ERR!   pid: 4176,
npm ERR!   stdout: Buffer(0) [Uint8Array] [],
npm ERR!   stderr: Buffer(392) [Uint8Array] [
npm ERR!     110, 112, 109,  32,  69,  82,  82,  33,  32,  99, 111, 100,
npm ERR!     101,  32,  69,  84,  65,  82,  71,  69,  84,  10, 110, 112,
npm ERR!     109,  32,  69,  82,  82,  33,  32, 110, 111, 116,  97, 114,
npm ERR!     103, 101, 116,  32,  78, 111,  32, 109,  97, 116,  99, 104,
npm ERR!     105, 110, 103,  32, 118, 101, 114, 115, 105, 111, 110,  32,
npm ERR!     102, 111, 117, 110, 100,  32, 102, 111, 114,  32,  64, 110,
npm ERR!     117, 116,  45, 116, 114, 101, 101,  47, 111, 112, 101, 110,
npm ERR!      99, 118,  45,  98, 117, 105, 108, 100,  45, 119, 105, 110,
npm ERR!      51,  50,  64, 117,
npm ERR!     ... 292 more items
npm ERR!   ]
npm ERR! }

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\nuc\AppData\Local\npm-cache\_logs\2022-01-08T12_24_23_418Z-debug-0.log

C:\Users\nuc\Documents\GitHub\new-project>node -v
v16.13.1

C:\Users\nuc\Documents\GitHub\new-project>npm -v
8.3.0

And the speculative fix

C:\Users\nuc\Documents\GitHub\new-project>set npm_package_config_opencv=4.1.1-7

C:\Users\nuc\Documents\GitHub\new-project>npm i @nut-tree/template-matcher

added 43 packages, and audited 282 packages in 5m

10 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

C:\Users\nuc\Documents\GitHub\new-project>node index.js
C:\Users\nuc\Documents\GitHub\new-project\node_modules\opencv4nodejs-prebuilt\lib\cv.js:14
  throw err
  ^

Error: The specified module could not be found.
\\?\C:\Users\nuc\Documents\GitHub\new-project\node_modules\opencv4nodejs-prebuilt\build\Release\opencv4nodejs.node
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1183:18)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Users\nuc\Documents\GitHub\new-project\node_modules\opencv4nodejs-prebuilt\lib\cv.js:11:8)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
  code: 'ERR_DLOPEN_FAILED'
}

C:\Users\nuc\Documents\GitHub\new-project>type index.js
require('@nut-tree/template-matcher');

@s1hofmann
Copy link
Member

And you have met the prerequisites?

Because I can't reproduce this issue and a missing runtime could cause this problem.

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
                                                                                                                        Try the new cross-platform PowerShell https://aka.ms/pscore6                                                                                                                                                                                    PS C:\Users\s1hofmann> mkdir template                                                                                   

    Directory: C:\Users\s1hofmann


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----        08/01/2022     13:33                template


PS C:\Users\s1hofmann> cd .\template\
PS C:\Users\s1hofmann\template> npm -v
8.1.2
PS C:\Users\s1hofmann\template> node -v
v16.13.1
PS C:\Users\s1hofmann\template> npm init -y
Wrote to C:\Users\s1hofmann\template\package.json:

{
  "name": "template",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}

PS C:\Users\s1hofmann\template> npm i @nut-tree/nut-js @nut-tree/template-matcher
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142

added 281 packages, and audited 282 packages in 34s

10 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

@kokarn
Copy link
Author

kokarn commented Jan 8, 2022

The prereq is only the Microsoft Visual C++ Redistributable, correct? If so then yes. Does it matter which windows version it is perhaps?

EDIT: To clarify
image

@kokarn
Copy link
Author

kokarn commented Jan 8, 2022

Your clue of "prerequisites" solved it for me. Another repository I have run had other weird issues on my windowses, the N version. The reason is that they are missing the "Media Feature Pack".

As that was also OpenCv I tried it out, and it works. It's the Media Feature Pack which is missing both on some N versions and other more streamlined versions of Windows.

The type initializer for 'OpenCvSharp.NativeMethods' threw an exception.
This probably means you are missing the Windows Media Features.

There are two ways to install the Media Feature Pack:

* Navigate to Settings > Apps > Apps and features > Optional features > Add a feature, and then locate Media Feature Pack in the list of available optional features.
* Download the pack installer for your Windows version from here and run it.
  * After the installation has finished, restart your computer to make sure the changes are applied.

Installing that feature solves the install & run issues 👍

@kokarn kokarn closed this as completed Jan 8, 2022
@s1hofmann
Copy link
Member

Learned something new today, I didn’t even know these versions existed.

Thanks for your follow up and the detailed solution 👍

@aabluedragon
Copy link

aabluedragon commented May 4, 2023

Same problem, using Windows 11.
"Media Features" is installed in "Optional Features"
image
Also, if I try to look up that feature under "View Features", nothing is found:
image

Happens when running the command: npm i @nut-tree/template-matcher
Used NodeJS 19.7.0
Also tried set npm_package_config_opencv=4.1.1-7

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

No branches or pull requests

3 participants