Cordova not properly installed or conflicting with powershell 7 core
- Dominant language
- JavaScript
- Stars
- 967
- Forks
- 344
- Avg merge
- 8h 41m
- Merged PRs (30d)
- 9
Description
# Bug Report
Cordova not properly installed or conflicting with powershell 7
## Problem
Can't use cordova on my windows 10 PC
### What is expected to happen?
After installing cordova via command prompt, I haven't been able to create a project or even test the version with `cordova`
### What does actually happen?
The code below is always generate
## Information
C:\Users\Stephynoe\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 argument '(Get-CimInstance -ClassName Win32_OperatingSystem).caption' is not recognized as the name of a script file. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Usage: pwsh[.exe] [-Login] [[-File] [args]]
[-Command { - | [-args ]
| [] } ]
[-ConfigurationName ] [-CustomPipeName ]
[-EncodedCommand ]
[-ExecutionPolicy ] [-InputFormat {Text | XML}]
[-Interactive] [-MTA] [-NoExit] [-NoLogo] [-NonInteractive] [-NoProfile]
[-OutputFormat {Text | XML}] [-SettingsFile ] [-STA] [-Version]
[-WindowStyle ] [-WorkingDirectory <directoryPath>]
pwsh[.exe] -h | -Help | -? | /?
PowerShell Online Help https://aka.ms/powershell-docs
All parameters are case-insensitive.
at makeError (C:\Users\Stephynoe\AppData\Roaming\npm\node_modules\cordova\node_modules\windows-release\node_modules\execa\index.js:174:9)
at Function.module.exports.sync (C:\Users\Stephynoe\AppData\Roaming\npm\node_modules\cordova\node_modules\windows-release\node_modules\execa\index.js:338:15)
at windowsRelease (C:\Users\Stephynoe\AppData\Roaming\npm\node_modules\cordova\node_modules\windows-release\index.js:39:19)
at osName (C:\Users\Stephynoe\AppData\Roaming\npm\node_modules\cordova\node_modules\os-name\index.js:39:18)
at new Insight (C:\Users\Stephynoe\AppData\Roaming\npm\node_modules\cordova\node_modules\insight\lib\index.js:37:13)
at new RelentlessInsight (C:\Users\Stephynoe\AppData\Roaming\npm\node_modules\cordova\src\telemetry.js:31:1)
at Object.<anonymous> (C:\Users\Stephynoe\AppData\Roaming\npm\node_modules\cordova\src\telemetry.js:39:15)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32) {
code: 64,
stdout: '\r\n' +
'Usage: pwsh[.exe] [-Login] [[-File] <filePath> [args]]\r\n' +
' [-Command { - | <script-block> [-args <arg-array>]\r\n' +
' | <string> [<CommandParameters>] } ]\r\n' +
' [-ConfigurationName <string>] [-CustomPipeName <string>]\r\n' +
' [-EncodedCommand <Base64EncodedCommand>]\r\n' +
' [-ExecutionPolicy <ExecutionPolicy>] [-InputFormat {Text | XML}]\r\n' +
' [-Interactive] [-MTA] [-NoExit] [-NoLogo] [-NonInteractive] [-NoProfile]\r\n' +
' [-OutputFormat {Text | XML}] [-SettingsFile <filePath>] [-STA] [-Version]\r\n' +
' [-WindowStyle <style>] [-WorkingDirectory <directoryPath>]\r\n' +
'\r\n' +
' pwsh[.exe] -h | -Help | -? | /?\r\n' +
'\r\n' +
'PowerShell Online Help https://aka.ms/powershell-docs\r\n' +
'\r\n' +
'All parameters are case-insensitive.\r\n',
stderr: "The argument '(Get-CimInstance -ClassName Win32_OperatingSystem).caption' is not recognized as the name of a script file. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.\r\n",
failed: true,
signal: null,
cmd: 'powershell (Get-CimInstance -ClassName Win32_OperatingSystem).caption',
timedOut: false
### Command or Code
<!-- What command or code is needed to reproduce the problem? -->
`cordova --version` or `cordova -v`
### Environment, Platform, Device
<!-- In what environment, on what platform or on which device are you experiencing the issue? -->
Microsoft Windows [Version 10.0.10240]
### Version information
<!--
What are relevant versions you are using?
For example:
Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins
Other Frameworks: Ionic Framework and CLI version
Operating System, Android Studio, Xcode etc.
-->
+-- @angular/cli@10.0.8
+-- cordova@10.0.0
+-- ionic@5.4.16
+-- native-run@1.1.0
`-- phonegap@9.0.0
javac 14.0.2
## Checklist
<!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
Contributor guide
Research direction
Start with the stack-trace locations in node_modules/windows-release/index.js, node_modules/execa/index.js, and src/telemetry.js, then reproduce `cordova --version` or `cordova -v` on the reported Windows 10 and PowerShell 7 environment. Done means the Cordova CLI can report its version and create a project without the shown PowerShell error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs, powershell
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100