I tried to install cordova with " npm install -g cordova" When I run the command "cordova -v" or "cordova -V" or "cordova --version" I am getting this error. Please help to resolve the issue
C:\Users\Admin>cordova -v
C:\Users\Admin\AppData\Roaming\npm\node_modules\cordova\node_modules\windows-release\node_modules\execa\index.js:347
throw err;
^
Error: Command failed: powershell (Get-CimInstance -ClassName Win32_OperatingSystem).caption
The term 'Get-CimInstance' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if
a path was included, verify that the path is correct and try again.
At line:1 char:17
+ (Get-CimInstance <<<< -ClassName Win32_OperatingSystem).caption
+ CategoryInfo : ObjectNotFound: (Get-CimInstance:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
at makeError (C:\Users\Admin\AppData\Roaming\npm\node_modules\←[4mcordova←[24m\node_modules\←[4mwindows-release←[24m\node_modules\←[4mexeca←[24m\ind
ex.js:174:9)
at Function.module.exports.sync (C:\Users\Admin\AppData\Roaming\npm\node_modules\←[4mcordova←[24m\node_modules\←[4mwindows-release←[24m\node_modules
\←[4mexeca←[24m\index.js:338:15)
at windowsRelease (C:\Users\Admin\AppData\Roaming\npm\node_modules\←[4mcordova←[24m\node_modules\←[4mwindows-release←[24m\index.js:39:19)
at osName (C:\Users\Admin\AppData\Roaming\npm\node_modules\←[4mcordova←[24m\node_modules\←[4mos-name←[24m\index.js:39:18)
at new Insight (C:\Users\Admin\AppData\Roaming\npm\node_modules\←[4mcordova←[24m\node_modules\←[4minsight←[24m\lib\index.js:37:13)
at new RelentlessInsight (C:\Users\Admin\AppData\Roaming\npm\node_modules\←[4mcordova←[24m\src\telemetry.js:31:1)
at Object.<anonymous> (C:\Users\Admin\AppData\Roaming\npm\node_modules\←[4mcordova←[24m\src\telemetry.js:39:15)
←[90m at Module._compile (internal/modules/cjs/loader.js:1118:30)←[39m
←[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1138:10)←[39m
←[90m at Module.load (internal/modules/cjs/loader.js:982:32)←[39m {
code: ←[33m1←[39m,
stdout: ←[32m''←[39m,
stderr: ←[32m"The term 'Get-CimInstance' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of
the name, or if\r\n"←[39m +
←[32m' a path was included, verify that the path is correct and try again.\r\n'←[39m +
←[32m'At line:1 char:17\r\n'←[39m +
←[32m'+ (Get-CimInstance <<<< -ClassName Win32_OperatingSystem).caption\r\n'←[39m +
←[32m' + CategoryInfo : ObjectNotFound: (Get-CimInstance:String) [], CommandNotFoundException\r\n'←[39m +
←[32m' + FullyQualifiedErrorId : CommandNotFoundException\r\n'←[39m +
←[32m' \r\n'←[39m,
failed: ←[33mtrue←[39m,
signal: ←[1mnull←[22m,
cmd: ←[32m'powershell (Get-CimInstance -ClassName Win32_OperatingSystem).caption'←[39m,
timedOut: ←[33mfalse←[39m
}
C:\Users\Admin>
Get-CimInstance
was introduced in Powershell v3. It was not available previously.
The rough equivalent in Powershell v2 is Get-WmiObject
, but be advised that that command was superseded and deprecated by the Get-Cim*
commands. As of Powershell v6, Get-WmiObject
no longer exists.
Both Powershell v2 and Windows 7 are at end of life (as of January 2020), and should be considered insecure and inappropriate for contemporary usage. That said, Windows 7 does support Powershell v5 through Windows Management Framework 5.1 , although Microsoft is no longer under any obligation to host that file for Windows 7 so it may not remain available.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.