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

Bug report #21

Open
Utsav-Ladani opened this issue Nov 19, 2020 · 0 comments
Open

Bug report #21

Utsav-Ladani opened this issue Nov 19, 2020 · 0 comments

Comments

@Utsav-Ladani
Copy link

Utsav-Ladani commented Nov 19, 2020

Error

Get error when try to use windowsRelease function.

Environment

  • npm versions: not important
  • OS: windows 7

Possible Solution

Yeah, I solved this issue.

Let me tell you why this happen?

windows-release have two commands to check OS name

  1. wmic os get Caption
  2. Get-CimInstance -ClassName Win32_OperatingSystem

When this module try to find os name, it generate error. Because wmic.exe file's path not added in Environment variables and Get-CimInstance is may be old.

Solution

I found Get-CimInstance command may be old (not sure) so we don't need to anything with it.
But wmic is a executable file in C:\Windows\System32\wbem. If we add this file's path in our environment variable, then error will resolve, too simple. But this is use side solution, so it's not good because users may be don't know that their's error produced by this module, then they can't get right solution.

So what can we do?

I got this issue yesterday in mongoDB compass, i try to found solution on internet but i can't find anything. So I try myself, follow codebase and finally found that error is generated by this module.

So I found that Get-CimInstance is may be old and and wmic is not work if user don't add path of wmic.exe in environment variables. But I found new command 'Get-WmiObject' and it is work in all windows OS (not sure). So we can add one more option in function to check OS name. Just we need to replace "Get-CimInstance" with "Get-WmiObject" and it will work.

I hope problem will resolve.
👍

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

1 participant