On Gitbash - Bower : ENOGIT git is not installed or not in the PATH

允我心安 提交于 2019-12-10 10:04:42

问题


I have a project with bower.json file and im trying to load all it's bower libraries on Windows. I turn on Gitbash, cd to that project directory and type in bower install / bower update. I receive an error:

bower ENOGIT        git is not installed or not in the PATH

But there is a path to git:

$ which git
/bin/git

So the wierd thing that it actually works in cmd on Windows, but it doesnt work with Gitbash. This is the value i have in the system PATH env variable regarding git:

C:\Program Files (x86)\Develop\VCS\Git\cmd

I tried to re-install msysgit and chose the option: Run Git From Windows Command Prompt like so:

It still doesnt seem to work..

Bower version:

$ bower --version
1.4.1

Git version:

$ git --version
git version 1.9.5.msysgit.1
  • Bower is installed globally using npm

EDIT: I found the cause of this issue: I have a file in my profile home directory .bashrc that i usually use in order to define general aliases and so on and i added this line:

export PATH="~/AppData/Roaming/Composer/vendor/bin":$PATH

And somehow when this line is present i receive the error in Gitbash, wierd though, it just add the path to global composer packages, what it has to do with git itself or bower?


回答1:


Check this solution posted by saurabhkohli in this GitHub issue:

[U]pdating the PATH environment variable with the current installed location of the GIT in your system will help resolve this issue, or you can update the same in your NodeJS command prompt by using "set PATH=%PATH%;C:\Program Files\Git\bin;"




回答2:


I just hit the same issue when trying to use windows command line. Turns out, you have to select this setting twice and I have missed the second one.

Here's a few screenshots if any help for anyone:

The one I have missed:

After reinstalling with the above settings, everything seem to be ok.




回答3:


Try to unzip a portable Git in a simpler path (no space).
Take the latest one from git for Windows: PortableGit-2.4.5.1-4th-release-candidate-64-bit.7z.exe.
(no setup required, just an auto-extractable archive here)

Remove from your PATH the old msysgit, and add C:\path\to\PortableGit-2.4.5.1-4th-release-candidate-64-bit\bin to the %PATH%.



来源:https://stackoverflow.com/questions/31488176/on-gitbash-bower-enogit-git-is-not-installed-or-not-in-the-path

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!