Unable to load package 'opencv4nodejs': Cannot find module
Pewliedie opened this issue ยท 10 comments
[Support] Unable to load package 'opencv4nodejs': Cannot find module '/usr/local/lib/node_modules/opencv4nodejs/build/Release/opencv4nodejs'
[Support] Require stack:
[Support] - /usr/local/lib/node_modules/opencv4nodejs/lib/cv.js
[Support] - /usr/local/lib/node_modules/opencv4nodejs/lib/opencv4nodejs.js
[Support] - /usr/local/lib/node_modules/appium/node_modules/appium-support/build/lib/node.js
[Support] - /usr/local/lib/node_modules/appium/node_modules/appium-support/build/lib/image-util.js
[Support] - /usr/local/lib/node_modules/appium/node_modules/appium-support/build/index.js
[Support] - /usr/local/lib/node_modules/appium/build/lib/logsink.js
[Support] - /usr/local/lib/node_modules/appium/build/lib/main.js
I explicitly set the OPENCV4NODEJS_DISABLE_AUTOBUILD=1
I've installed opencv4nodejs through brew install v3.4.14
and then run npm -g install opencv4nodejs
installation was successful
when I run appium-doctor
It shows that appium sees opencv library
it's strange that it shows that 5.6.0 version installed
When I'm trying to run test following error appears: Unable to load package 'opencv4nodejs': Cannot find module '/usr/local/lib/node_modules/opencv4nodejs/build/Release/opencv4nodejs'
but actual location: /usr/local/lib/node_modules/opencv4nodejs/build/Release/obj.target/opencv4nodejs
tried to remove obj.target folder it didnโt help
With OpenCV-contrib? (extra modules): no
Appium v 1.21.0
MacOSX Big Sur 11.4
I too have the same issue with windows, any advice would greatly helpful.
[W3C (70d15ea8)] Calling AppiumDriver.compareImages() with args: ["getSimilarity","utils/Actual_screenshot.png","utils/templates/rse/row_amzn_signin.png",{},null,null,"70d15ea8-0c9d-4d55-8739-b00d9f72f56a"]
[Support] Initializing opencv
[Support] Loading local package 'opencv4nodejs'
[Support] Failed to load local package 'opencv4nodejs': Cannot find module 'opencv4nodejs'
[Support] Require stack:
[Support] - C:\Users\venugopalvisw\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-support\build\lib\node.js
[Support] - C:\Users\venugopalvisw\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-support\build\lib\image-util.js
[Support] - C:\Users\venugopalvisw\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-support\build\index.js
[Support] - C:\Users\venugopalvisw\AppData\Local\Programs\Appium\resources\app\node_modules\appium\build\lib\logsink.js
[Support] - C:\Users\venugopalvisw\AppData\Local\Programs\Appium\resources\app\node_modules\appium\build\lib\main.js
[Support] - C:\Users\venugopalvisw\AppData\Local\Programs\Appium\resources\app\dist\main.js
[Support] -
[Support] Failed to load global package 'opencv4nodejs': The "path" argument must be of type string. Received type undefined
[Support] Linking package 'opencv4nodejs'
[Support] Retrying load of linked package 'opencv4nodejs'
[Support] Unable to load package 'opencv4nodejs': Cannot find module 'opencv4nodejs'
[Support] Require stack:
[Support] - C:\Users\venugopalvisw\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-support\build\lib\node.js
[Support] - C:\Users\venugopalvisw\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-support\build\lib\image-util.js
[Support] - C:\Users\venugopalvisw\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-support\build\index.js
[Support] - C:\Users\venugopalvisw\AppData\Local\Programs\Appium\resources\app\node_modules\appium\build\lib\logsink.js
[Support] - C:\Users\venugopalvisw\AppData\Local\Programs\Appium\resources\app\node_modules\appium\build\lib\main.js
[Support] - C:\Users\venugopalvisw\AppData\Local\Programs\Appium\resources\app\dist\main.js
[Support] -
[Support] Unable to load 'opencv4nodejs': Unable to load package 'opencv4nodejs': Cannot find module 'opencv4nodejs'
[Support] Require stack:
[Support] - C:\Users\venugopalvisw\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-support\build\lib\node.js
[Support] - C:\Users\venugopalvisw\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-support\build\lib\image-util.js
[Support] - C:\Users\venugopalvisw\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-support\build\index.js
[Support] - C:\Users\venugopalvisw\AppData\Local\Programs\Appium\resources\app\node_modules\appium\build\lib\logsink.js
[Support] - C:\Users\venugopalvisw\AppData\Local\Programs\Appium\resources\app\node_modules\appium\build\lib\main.js
[Support] - C:\Users\venugopalvisw\AppData\Local\Programs\Appium\resources\app\dist\main.js
[Support] -
[W3C (70d15ea8)] Encountered internal error running command: Error: 'opencv4nodejs' module is required to use OpenCV features. Please install it first ('npm i -g opencv4nodejs') and restart Appium. Read https://github.com/justadudewhohacks/opencv4nodejs#how-to-install for more details on this topic.
[W3C (70d15ea8)] at initOpenCV (C:\Users\venugopalvisw\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-support\lib\image-util.js:109:11)
[HTTP] <-- POST /wd/hub/session/70d15ea8-0c9d-4d55-8739-b00d9f72f56a/appium/compare_images 500 1718 ms - 1095
appium doctor detects opencv4nodejs
โ opencv4nodejs is installed at: C:\Users\venugopalvisw\AppData\Roaming\npm. Installed version is: 5.6.0
I can confirm nodecv4nodejs is installed
C:\Program Files\nodejs\node_modules>npm list -g opencv4nodejs
C:\Users\venugopalvisw\AppData\Roaming\npm
`-- opencv4nodejs@5.6.0
but using with appium throws - Failed to load local package 'opencv4nodejs': Cannot find module 'opencv4nodejs'
the same issue here on mac m1
/Users/mohamedgamal/.npm-global/lib
โโโ opencv4nodejs@5.6.0
Executing command 'compareImages'
[debug] [Support] Initializing opencv
[debug] [Support] Loading local package 'opencv4nodejs'
[debug] [Support] Failed to load local package 'opencv4nodejs': Cannot find module '/opt/homebrew/lib/node_modules/opencv4nodejs/build/Release/opencv4nodejs'
i am having the above issue also, I am on a mac with intel chip.
I believe this is most likely a versioning issue, there seems to a difference in the file structure that's called for and the one supplied by this version. i would guess slowly testing older and older versions would be a good place to start, ill post my results as soon as a find them. Cheers and good luck
After reading similar issues threads, it seems like this is an opencv4nodejs installation issue. Has anyone found a solution?
Having the same issue with Raspberry OS.
The same problem -> http://joxi.ru/8AnDXEWHNxWD1m
In your screenshot, I can see the @u4 version.
the u4 version requires you to call the build script build-opencv
that may change since my warning message may not be seen.
having same issue and fixed it !!
I've add below line to my zshrc and it works !
export NODE_PATH="/opt/homebrew/lib/node_modules"
obj.targe
have you found the solution ?