Missing git leads to not obvious error message on `platform add`
See original GitHub issueBug Report
Problem
For complicated reasons [1] I am trying to run cordova platform add https://github.com/apache/cordova-windows
in a temporarily elevated prompt. The way my system is set up, git
is only installed on my user account, but not for Admin.
This caused this non obvious (to me) error message:
PS E:\Projects\throwaway\cordovaAdminWindowsNpmFail> cordova platform add https://github.com/apache/cordova-windows
Using cordova-fetch for https://github.com/apache/cordova-windows
Failed to fetch platform https://github.com/apache/cordova-windows
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! path git
npm ERR! code ENOENT
npm ERR! errno ENOENT
npm ERR! syscall spawn git
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t https://github.com/apache/cordova-windows.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Admin\AppData\Roaming\npm-cache\_logs\2019-07-03T11_36_43_837Z-debug.log
After installing git
for the Admin user, this problem is gone.
Maybe we can give better error messages here?
Checklist
- I searched for existing GitHub issues
- I updated all Cordova tooling to most recent version
- I included all the necessary information above
[1] I am trying to get Paramedic CI to work for cordova-windows. As AppVeyor, the CI we use runs in admin mode, I have to remove an exception from cordova-windows that is thrown if run in an admin prompt. To test this, I am trying to run paramedic’s Windows tests locally, which works for non-admin prompts, but not admin ones. To understand I am trying to run the commands manually, but encountered this problem.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:5 (5 by maintainers)
Top GitHub Comments
😂
I mean I totally agree that it would be nice to have a better error message in this case.
Handling the error with a more explicit error message after it failed would actually be enough.