question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing git leads to not obvious error message on `platform add`

See original GitHub issue

Bug 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:open
  • Created 4 years ago
  • Reactions:2
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
raphinessecommented, Jul 3, 2019

Bad npm 🐕

😂

I mean I totally agree that it would be nice to have a better error message in this case.

1reaction
janpiocommented, Jul 3, 2019

Handling the error with a more explicit error message after it failed would actually be enough.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add a better error message when /hooks folder is missing in a ...
My repositories are stored on a mounted NFS share, the path is correct in gitlab.yml and everything works 100% correctly.
Read more >
Git warning: Pulling without specifying how to reconcile ...
In this case, it is obvious to Git that by adding zyx911 to our commits, we'll be in sync. This is called a...
Read more >
Jenkins: Failed to connect to repository - git - Stack Overflow
Run the command showing in the Jenkins error message, on your teminal (eg : "git ls-remote -h git@github.com:adolfosrs/jenkins-test.git HEAD"); You will be ...
Read more >
How do I force git pull to overwrite local files? - Tower Git Client
The reason for error messages like these is rather simple: you have local changes that would be overwritten by the incoming new changes...
Read more >
fatal: not a git repository (or any of the parent directories): .git
What the error is telling you is that you issued a Git command, (usually within a command line shell), inside a directory that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found