question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to load 'opencv4nodejs' even if it's installed and detected

See original GitHub issue

The problem

When i use the driver.find_element_by_image feature from the appium python client, Appium CLI says the opencv4nodejs package "path" argument must be of type string. Received type undefined when trying to initialize opencv4nodejs

Environment

  • Appium version (or git revision) that exhibits the issue: 1.17.0
  • Desktop OS/version used to run Appium: Ubuntu 20.04
  • Node.js version (unless using Appium.app|exe): v10.19.0
  • Npm or Yarn package manager: npm v6.14.4
  • Mobile platform/version under test: Android 5.1.1
  • Real device or emulator/simulator: Real device
  • Appium CLI or Appium.app|exe: CLI
  • opencv4nodejs version: latest (5.6.0)

Details

I recently diched windows for ubuntu and i was trying to reinstall my project. I’ve encountered this error : [Support] Unable to load package 'opencv4nodejs': Cannot find module '/usr/local/lib/node_modules/opencv4nodejs/build/Release/opencv4nodejs'

However, there is no build folder inside the opencv4nodejs module.

So, i’ve came to the conclusion that the linking is deprecated since opencv4nodejs latest version is installed properly on my system globally.

Link to Appium logs

appium-cli error logs + appium-doctor dependency checks + opencv4nodejs module

concerned appium feature

Code To Reproduce Issue [ Good To Have ]

How i proceeded installation:

sudo npm i -g appium opencv4nodejs appium-doctor --allow-root --unsafe-perm=true

Server options:

[
  {
    "shutdownOnPowerDisconnect": false,
    "getMatchedImageResult": true,
    "imageMatchThreshold": 0.3,
    "fixImageTemplateSize": false
  }
]

Client test:

assert element = driver.find_element_by_image('./path/to/image.png')

Tried solutions:

sudo apt update
sudo npm link opencv4nodejs
sudo npm unistall appium
sudo npm install appium@1.17.1
sudo npm unistall appium
sudo npm install appium@1.16.0
sudo npm unistall appium
sudo npm install appium@beta

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:23

github_iconTop GitHub Comments

1reaction
77etherscommented, Jul 7, 2021

after installing cmake, run the npm i opencv4nodejs command on another terminal. It worked for me 😃

0reactions
SyedRiyaz1commented, Aug 20, 2020

Need to Test on android and IOS platforms …

On Thu, Aug 20, 2020 at 2:21 PM Riyaz Inamdar riyaz.selenium@gmail.com wrote:

Hi, it is Related windows …

On Thu, Aug 20, 2020 at 2:18 PM Richard notifications@github.com wrote:

That’s weird, i’m out of options now. I don’t have Windows so i don’t if it’s related to windows or not. I’m coming back with a proposition

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/appium/appium/issues/14565#issuecomment-677466452, or unsubscribe https://github.com/notifications/unsubscribe-auth/AONSOZGKKLSAOFIGQVX57ODSBTPNZANCNFSM4O55XU5Q .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failing to install opencv4nodejs on Mac (Apple M1) throws ...
It worked when specifically installing opencv-build before-hand, but make sure neither opencv-build nor opencv4nodejs are actually defined ...
Read more >
When I tried to install opencv4nodejs I am getting an error
So when I entered that I got one more issue which I am not able to understand because it is telling me to...
Read more >
Opencv4nodejs module not found - Support - Appium Discuss
Hi, I am using Opencv4nodejs to compare icons. I have installed it and my appium-doctor can see it ( info AppiumDoctor :heavy_check_mark: ...
Read more >
@u4/opencv4nodejs NPM | npm.io
Under Linux we have to build OpenCV from source manually or using the auto build script. Installing OpenCV via Auto Build Script. The...
Read more >
Npm install error(fails) - M220JS - MongoDB
Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found