Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

fix: call requirePackage in doctor #118

Closed
wants to merge 4 commits into from

Conversation

KazuCocoa
Copy link
Member

@KazuCocoa KazuCocoa commented Apr 19, 2021

closes #84

Noticed getNpmPackageInfo did not work well like requirePackage in some cases.
e.g. global install of mjpeg-comsumer.

Appium uses requirePackage to resolve a package, so let's use the same method to check if it is installed.
I also noticed packageInfo.version was undefined in mjpeg-comsumer, so simply let me show if the package is installed.


info AppiumDoctor Appium Doctor v.1.16.0
info AppiumDoctor ### Diagnostic for necessary dependencies starting ###
info AppiumDoctor  ✔ The Node.js binary was found at: /Users/kazuaki/.nodebrew/current/bin/node
info AppiumDoctor  ✔ Node version is 12.21.0
ERR! Support Unable to load package 'opencv4nodejs': Cannot find module '/Users/kazuaki/.nodebrew/node/v12.21.0/lib/node_modules/opencv4nodejs/build/Release/opencv4nodejs'
ERR! Support Require stack:
ERR! Support - /Users/kazuaki/.nodebrew/node/v12.21.0/lib/node_modules/opencv4nodejs/lib/cv.js
ERR! Support - /Users/kazuaki/.nodebrew/node/v12.21.0/lib/node_modules/opencv4nodejs/lib/opencv4nodejs.js
ERR! Support - /Users/kazuaki/GitHub/appium-doctor/node_modules/appium-support/build/lib/node.js
ERR! Support - /Users/kazuaki/GitHub/appium-doctor/node_modules/appium-support/build/lib/image-util.js
ERR! Support - /Users/kazuaki/GitHub/appium-doctor/node_modules/appium-support/build/index.js
ERR! Support - /Users/kazuaki/GitHub/appium-doctor/build/lib/logger.js
ERR! Support - /Users/kazuaki/GitHub/appium-doctor/build/lib/doctor.js
ERR! Support - /Users/kazuaki/GitHub/appium-doctor/build/lib/factory.js
ERR! Support - /Users/kazuaki/GitHub/appium-doctor/build/bin/appium-doctor.js
ERR! Support - /Users/kazuaki/GitHub/appium-doctor/appium-doctor.js
info AppiumDoctor  ✔ Xcode is installed at: /Applications/Xcode_12.4.app/Contents/Developer
info AppiumDoctor  ✔ Xcode Command Line Tools are installed in: /Applications/Xcode_12.4.app/Contents/Developer
info AppiumDoctor  ✔ DevToolsSecurity is enabled.
info AppiumDoctor  ✔ The Authorization DB is set up properly.
info AppiumDoctor  ✔ Carthage was found at: /usr/local/bin/carthage. Installed version is: 0.35.0
info AppiumDoctor  ✔ HOME is set to: /Users/kazuaki
info AppiumDoctor  ✔ ANDROID_HOME is set to: /Users/kazuaki/Library/Android/sdk
info AppiumDoctor  ✔ JAVA_HOME is set to: /Applications/Android Studio Preview.app/Contents/jre/jdk/Contents/Home
info AppiumDoctor    Checking adb, android, emulator, apkanalyzer
info AppiumDoctor      'adb' is in /Users/kazuaki/Library/Android/sdk/platform-tools/adb
info AppiumDoctor      'android' is in /Users/kazuaki/Library/Android/sdk/tools/android
info AppiumDoctor      'emulator' is in /Users/kazuaki/Library/Android/sdk/emulator/emulator
info AppiumDoctor      'apkanalyzer' is in /Users/kazuaki/Library/Android/sdk/cmdline-tools/latest/bin/apkanalyzer
info AppiumDoctor  ✔ adb, android, emulator, apkanalyzer exist: /Users/kazuaki/Library/Android/sdk
info AppiumDoctor  ✔ 'bin' subfolder exists under '/Applications/Android Studio Preview.app/Contents/jre/jdk/Contents/Home'
info AppiumDoctor ### Diagnostic for necessary dependencies completed, no fix needed. ###
info AppiumDoctor 
info AppiumDoctor ### Diagnostic for optional dependencies starting ###
ERR! Support Unable to load package 'opencv4nodejs': Cannot find module '/Users/kazuaki/.nodebrew/node/v12.21.0/lib/node_modules/opencv4nodejs/build/Release/opencv4nodejs'
ERR! Support Require stack:
ERR! Support - /Users/kazuaki/.nodebrew/node/v12.21.0/lib/node_modules/opencv4nodejs/lib/cv.js
ERR! Support - /Users/kazuaki/.nodebrew/node/v12.21.0/lib/node_modules/opencv4nodejs/lib/opencv4nodejs.js
ERR! Support - /Users/kazuaki/GitHub/appium-doctor/node_modules/appium-support/build/lib/node.js
ERR! Support - /Users/kazuaki/GitHub/appium-doctor/node_modules/appium-support/build/lib/image-util.js
ERR! Support - /Users/kazuaki/GitHub/appium-doctor/node_modules/appium-support/build/index.js
ERR! Support - /Users/kazuaki/GitHub/appium-doctor/build/lib/logger.js
ERR! Support - /Users/kazuaki/GitHub/appium-doctor/build/lib/doctor.js
ERR! Support - /Users/kazuaki/GitHub/appium-doctor/build/lib/factory.js
ERR! Support - /Users/kazuaki/GitHub/appium-doctor/build/bin/appium-doctor.js
ERR! Support - /Users/kazuaki/GitHub/appium-doctor/appium-doctor.js
WARN AppiumDoctor  ✖ opencv4nodejs cannot be found.
info AppiumDoctor  ✔ ffmpeg is installed at: /usr/local/bin/ffmpeg. ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
info AppiumDoctor  ✔ mjpeg-consumer is installed.

hm... error appeared twice.

@KazuCocoa KazuCocoa changed the title Tweak mjpeg consumer fix: call requirePackage in doctor Apr 19, 2021
lib/general.js Outdated Show resolved Hide resolved
lib/general.js Outdated Show resolved Hide resolved
lib/general.js Outdated Show resolved Hide resolved
await node.requirePackage(packageName);
return okOptional(`${packageName} is installed.`);
} catch (ign) {
return nokOptional(`${packageName} cannot be found.`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would still prefer to show the original error here. Some packages just error out after being imported , even though after it looks like they were installed properly (hello opencv4nodejs 👋 )

@KazuCocoa KazuCocoa closed this Sep 8, 2022
@KazuCocoa KazuCocoa deleted the tweak-mjpeg-consumer branch September 8, 2022 07:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue with finding mjpeg-consumer
2 participants