albertinad / brackets-bower

Bower integration in Brackets.
MIT License
47 stars 9 forks source link

Bower Warning: Git wasn't found on your system #80

Closed JKVeganAbroad closed 8 years ago

JKVeganAbroad commented 8 years ago

Firstly, lets establish that I have no 3rd party command-line software installed on my Mac (OS X 10.11.1 El Capitan). i.e. No NPM, no Node.js, no Bower, no Git, nothing.

I've freshly installed Brackets, and the first thing I do is click on: File » Extension Manager... » Brackets Bower » Install

Then I get the following warning message:

Bower Warning

Git wasn't found on your system

Brackets-bower extension searched for Git at the system PATH.

Bower requires Git installed, and configured in the system PATH variable, to download and install some packages. Brackets-bower extension may not work properly.

So I remove the extension, and proceed to install Git for Mac according to these requirements.

If I launch Terminal.app, I can now confirm the successful installation of Git via the git --version command:

MacBook:~ jkaussieskater$ git --version git version 2.6.2

I proceed to install the Bower extension in Brackets, and again, I get the same identical warning: "Git wasn't found on your system":

Brackets Bower Warning Screenshot

JKVeganAbroad commented 8 years ago

Sorry to be a drag on this issue, but I was hoping you might be able to help me out with it. So far, I have tried to look through your source code, but I can't find where your code looks for Git at the system PATH. I've noticed that in Brackets Git (which you may be familiar with) this code is used:

brackets-git/src/utils/Setup.js
var standardGitPathsWin = [
        "C:\\Program Files (x86)\\Git\\cmd\\git.exe",
        "C:\\Program Files\\Git\\cmd\\git.exe"
    ];

    var standardGitPathsNonWin = [
        "/usr/local/git/bin/git",
        "/usr/local/bin/git",
        "/usr/bin/git"
    ];

This code, or similar, appears to be absent from the Brackets Bower project. Perhaps this is why Git isn't being found on the system?

albertinad commented 8 years ago

Hi @JKAussieSkater, I'm familiar with the brackets-git extension, but how we handle git is different for both extensions. Brackets-git executes git, but brackets-bower extension, executes directly bower, and it is bower that executes git with the assumption that it is available at the system PATH. This is the module that checks for git in the system path in order to raise an error when it is not found,

https://github.com/albertinad/brackets-bower/blob/master/src/utils/GitUtils.js#L51

I don't use full path for the git binaries, since bower assumes that is available at the system PATH and spawns child process not using absolute path for the binary, but using "git". So I try to do the same.

Besides the error message, when you try to install a package, did it fails? To help discover the error, I will create a new release now, that I will upload to the registry later, that improves the error handling, and it will help me to solve this problem.

Thanks!

JKVeganAbroad commented 8 years ago

Thank you @albertinad! Apart from the error message, Brackets Bower appears to have been installed successfully; however when I try to install a package, clicking install appears to fail:

Bower Error

Bower unknown internal error.

bower unknown error

Additionally, when I attempt to install jQuery via Bower (File » Install from Bower...) I use the following input:

+jquery

and then I press [Enter] on my keyboard – nothing seems to happen: screen shot 2015-11-26 at 1 27 31 pm

Thanks again for looking into this!!! Are there ways I could further assist to resolve this?

albertinad commented 8 years ago

@JKAussieSkater can you execute some steps to help me get more information about the error and root cause? I've recently upload a pre-release version of the extension, it is not available in the extensions registry so you need to manually install it on brackets. Please, first download the zip file from this link: https://github.com/albertinad/brackets-bower/releases/tag/v0.2.15-pre

Then uninstall the brackets-bower extension that you have installed on brackets, restart it, and manually install the downloaded zip through the extension manager, by dragging the zip to the selected area. If that doesn't work for you, go to $HOME/Library/Application\ Support/Brackets/extensions/user/ and unzip it in there the downloaded zip file. Then restart brackets, and execute the following steps:

Thanks!

JKVeganAbroad commented 8 years ago

Okay, I just attempted to use jquery as a dependency via "dependencies": {"jquery": "~2.1.0"}. Here are the bower specific warning messages, which were the last warnings in the log output:

BowerJson.js:521 [bower] Error parsing bower.json SyntaxError: Unexpected token j
Bower.js:91 [brackets-bower] Error installing from bower.json {
  "code": 7,
  "message": null,
  "originalMessage": null,
  "originalError": {
    "code": "ECMDERR",
    "details": "xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun\n",
    "exitCode": 1,
    "data": {
      "endpoint": {
        "name": "jquery",
        "source": "jquery",
        "target": "~2.1.0"
      },
      "resolver": {
        "name": "jquery",
        "source": "git://github.com/jquery/jquery.git",
        "target": "~2.1.0"
      }
    }
  }
}

The remaining log output

The following output happens directly before the bower-specific warning messages mentioned above. There was no further log information after the bower warnings.

 Download the React DevTools for a better development experience: http://fb.me/react-devtools
/utils/DeprecationWarning.js:90 PreferencesManager.convertPreferences() has been deprecated. Please upgrade to the current Preferences system (https://github.com/adobe/brackets/wiki/Preferences-System#conversion-from-the-pre-36-preferences-system).
    at Object.convertPreferences (/preferences/PreferencesManager.js:325:28)
    at Object.eval (/utils/Resizer.js:548:24)
/utils/DeprecationWarning.js:90 Deprecated: Do not use $().on/off() on Brackets modules and model objects. Call on()/off() directly on the object without a $() wrapper.
    at new jQuery.fn.init (/brackets.js:474:36)
    at n (file:///Applications/Brackets.app/Contents/www/thirdparty/thirdparty.min.js:556:405)
    at Object.eval (/SASSAgent.js:161:5)
/utils/DeprecationWarning.js:90 Deprecated: Do not use $().on/off() on Brackets modules and model objects. Call on()/off() directly on the object without a $() wrapper.
    at new jQuery.fn.init (/brackets.js:474:36)
    at n (file:///Applications/Brackets.app/Contents/www/thirdparty/thirdparty.min.js:556:405)
    at Object.eval (/main.js:323:5)
/utils/DeprecationWarning.js:90 Deprecated: Do not use $().on/off() on Brackets modules and model objects. Call on()/off() directly on the object without a $() wrapper.
    at new jQuery.fn.init (/brackets.js:474:36)
    at n (file:///Applications/Brackets.app/Contents/www/thirdparty/thirdparty.min.js:556:405)
    at _statusChangeHandler (/SASSAgent.js:141:49)
    at Object.trigger (/utils/EventDispatcher.js:222:40)
    at _setStatus (/LiveDevelopment/LiveDevelopment.js:332:17)
    at Object.init (/LiveDevelopment/LiveDevelopment.js:1495:9)
    at eval (/LiveDevelopment/main.js:309:25)
    at _callHandler (/utils/AppInit.js:93:13)
    at Object._dispatchReady (/utils/AppInit.js:113:13)
/LiveDevelopment/MultiBrowserImpl/transports/NodeSocketTransport.js:87 NodeSocketTransport - start
albertinad commented 8 years ago

Thanks! Now I can see what is happening. So, my understanding, please forgive my lack of advanced knowledge on Mac, I'm new to the platform, is that git and some dev tools seems to be broken. Did you accept some license, terms and conditions to use git? Since git and some dev tools heavily depends on Xcode, you need to use Xcode dev tools to configure them, or accept terms and conditions, I believe that those tasks can be done through command line tools,

http://tips.tutorialhorizon.com/2015/10/01/xcrun-error-invalid-active-developer-path-library-developer-commandline-tools-missing-xcrun/

Can you try to run the command described in the above post?

That would require to have Xcode installed, but you can try doing the following, if you do not want to install Xcode,

http://blog.bobbyallen.me/2014/03/07/how-to-install-git-without-having-to-install-xcode-on-macosx/

Can you run in the terminal, $ which git to see the full path of the binary?

After that, try to add to your .bash_profile, located at your $HOME folder, if you are using bash, the following line,

alias git="<the-output-of-which-git>"

Close the terminal, restart brackets, and try the steps to install a package.

Thanks!

albertinad commented 8 years ago

Issue related #45

albertinad commented 8 years ago

Sorry! I closed it by mistake. Re open it.

JKVeganAbroad commented 8 years ago

When I first installed git using the automated Mac installer DMG/package, I was not prompted to accept a license agreement - everything seemed to work fine though.

$ which git /usr/local/bin/git

So, when I look in my home directory (I've configured Finder to show hidden .* files), there is no .bash_profile file. I guess some Macs don't have it. So I didn't worry about this step.

Unfortunately I didn't try the method where you don't need to install Xcode (alias git="/usr/local/git/bin/git").

However, doing what you first said, xcode-select --install, brought up the following dialogue:

xcode-install

I did NOT choose [Get Xcode]; I just clicked on [Install] to install the "Command Line Tools" (as you suggested). It took about 10 minutes. At some point it prompted me to accept a license agreement (which I did).

Not only does the dependency install, but the manual install textbox works too!

You are AMAZING!!! Thank you so much!

JKVeganAbroad commented 8 years ago

As a suggestion, perhaps the "Git wasn't found on your system" error message could identify if Brackets is running on Mac OS X, and if so, suggest to install Xcode Command Line Tools to resolve the issue.

By the way, should I revert to the "official" release of the Brackets Bower extension, or should I continue to use the special version?

albertinad commented 8 years ago

Great! I'm really happy that we found the root cause! I guess this is related with an old issue that I have related to git. Thank you very much for your time and helping me with this!

You can use the pre-release if you want, in the following days I will be releasing the new version. :)

Thank you for your suggestion, definitely I must improve the error messages, and also I would like to show the command error as part of the error message. I will leave this issue open, until the improvements related to git errors is done.

Thanks!

robbyakasipradana commented 8 years ago

just install "NodeJS" and bower is working

albertinad commented 8 years ago

Bower does not require NodeJS to be installed. The only dependency on the system is Git.

jfrimann commented 8 years ago

Hi @albertinad Following the instructions above, did not do it for me :-( I still get the same warning about the extension couldn't find Git at the system PATH. Any other suggestions?

JKVeganAbroad commented 8 years ago

@jfrimann, perhaps, if you've done all of the above, you're experiencing a completely different problem which unfortunately shares the same error message: Issue #84

Go there, and try the suggested workaround to see if that resolves the issue for you.

jfrimann commented 8 years ago

Thanks for the tip @JKAussieSkater However, it didn't do either. Tried reloading 10 times. Same result every time. Used the Brackets dev tools to check the console output but I don't get the same timeout warning as you did :-(