Git isn't currently a part of the build server setup

Mateus Cerqueira's Avatar

Mateus Cerqueira

04 Dec, 2015 03:34 PM

I successfully managed to run npm/bower/gulp scripts by editing .csproj file. But i got a problem when 'bower install' runs:

"ENOGIT git is not installed or not in the PATH"

Is there a way to run or install git in the server? Or there is a solution for this?

In my searches i've found this:
https://support.appharbor.com/discussions/problems/49026-running-gruntjs-in-msbuild-fails-because-of-old-nodejs-version

The solution proposed was to use a 'portable' git .exe to run on the server, but this answer is there for almost two years from now and i wanted to ask again before trying that.

More details in my stackoverflow question below:
http://stackoverflow.com/questions/34089661/running-bower-from-appharbor-build

  1. Support Staff 1 Posted by rune on 04 Dec, 2015 07:40 PM

    rune's Avatar

    Hi,

    Git is actually installed on the build servers since the support ticket you referenced, but it hasn't been added to the path which is probably the problem here.

    The install directory is C:\Program Files (x86)\Git (binaries in C:\Program Files (x86)\Git\bin) and I'll try and see if it's straightforward to add this without breaking things. In the meantime, I wonder if you could get around this by simply adding the git directory to the PATH before you run bower install. Based on the task in the Stack Overflow post you link to it could look something like this:

    <Target Name="BowerBuild">
        <Exec Command="set PATH=%PATH%;C:\Program Files (x86)\Git\bin" />
        <Exec Command="%USERPROFILE%\AppData\Roaming\npm\bower.cmd install" />
        <Exec Command="%USERPROFILE%\AppData\Roaming\npm\bower.cmd cache clean" />
        <Exec Command="%USERPROFILE%\AppData\Roaming\npm\bower.cmd update" />
        <Message Text="Bower Build Finished" />
    </Target>
    

    I haven't tested this (and maybe it's necessary to set it using setx instead, i.e. <Exec Command="setx PATH=%PATH%;C:\Program Files (x86)\Git\bin" />), but might be worth trying this as well?

    Best,
    Rune

  2. 2 Posted by Mateus Cerqueir... on 04 Dec, 2015 10:29 PM

    Mateus Cerqueira's Avatar

    Hello,

    If you could fix this it would be great :D

    I tried to add the PATH variable like you said in both ways (one at a time and both together) and they were set successfully but with no luck with bower/git :/

    And when i tried to add the PATH in the system variables (with the /M i.e. setx Path "%PATH%;C:\Program Files (x86)\Git\bin" /M) got access denied:
    "Access to the registry path is denied."

    My last test code was this:

    <Target Name="EnvironmentVariablesBuild">
        <Exec Command="set PATH=%PATH%;C:\Program Files (x86)\Git\bin" />
        <Exec Command='setx PATH "%PATH%;C:\Program Files (x86)\Git\bin"' />
        <Message Text="Environment Variables Build Finished" />
      </Target>
      <Target Name="NpmBuild"> <!--This part runs OK as AppHarbor machine has node installed-->
        <Exec Command="npm install" />
        <Exec Command="npm install bower -g" />
        <Exec Command="npm install gulp -g" />
        <Message Text="Npm Build Finished" />
      </Target>
      <Target Name="BowerBuild"> <!--This part fails because bower can't find Git-->
        <Exec Command="%USERPROFILE%\AppData\Roaming\npm\bower.cmd install" />
        <Exec Command="%USERPROFILE%\AppData\Roaming\npm\bower.cmd cache clean" />
        <Exec Command="%USERPROFILE%\AppData\Roaming\npm\bower.cmd update" />
        <Message Text="Bower Build Finished" />
      </Target>
      <Target Name="GulpBuild">
        <Exec Command="%USERPROFILE%\AppData\Roaming\npm\gulp build" />
        <Message Text="Gulp Build Finished" />
      </Target>
    

    Maybe rebooting the machine would apply the PATH variable or something like that?

    Waiting for a reply.
    Thanks for your help :)

  3. Support Staff 3 Posted by rune on 07 Dec, 2015 03:16 PM

    rune's Avatar

    Hi Mateus,

    OK got it, thanks for taking the time to try it anyway. The build servers have just been updated and now has git in the PATH by default -- can you give this another shot?

    This shouldn't cause issues, but we'll continue to monitor the build servers to see if it breaks other builds somehow. If it does we may have to roll back this change, but I'll make sure to give you an update here if/when that becomes relevant.

    Best,
    Rune

  4. 4 Posted by Mateus Cerqueir... on 07 Dec, 2015 06:55 PM

    Mateus Cerqueira's Avatar

    Yaay!! It worked :D

    But now i got another little problem x.x

    Some bower packages fail to download, and i think the solution is to run the following command:

    git config --global url."https://".insteadOf "git://"
    

    But when i run this i get the following error:

    fatal: Unable to read current working directory: No error

    And now i have no ideia how to proceed.

    Can you help me out again?
    Thanks !

  5. Support Staff 5 Posted by rune on 09 Dec, 2015 11:12 PM

    rune's Avatar

    Hi,

    Can you point me to the build where this is occurring? By the way, you'll likely be able to run this command with the "--global" flag set.

    Best,
    Rune

  6. 6 Posted by Mateus Cerqueir... on 10 Dec, 2015 02:00 AM

    Mateus Cerqueira's Avatar

    Hello,

    I've tried a lot of different things to execute that git command (with and without the "--global" flag) and configure bower but none of that helped.
    One of the things that i've tried was to list all the files and folders from the C:\Program Files (x86)\Git path and it was empty (which i didn't understand).

    I think the solution is indeed that command from my previous post.

    I'm sorry for my ignorance but i don't know exactly what do you mean by "pointing you the build" but here's some information of it:

    App Name: sgvclient
    Commit Id: 5bfd4090ee4e94635f8cc00b7b325e9f7598ce67
    Branch: new-start
    Commit Message: 'Git command fails.'
    Received: 12/9/15 11:46 PM
    Owner: mateusmcg

    I don't think the solution here is gonna be hard (maybe i'm missing a detail or configuration) but if you could look up into it, i'd appreciate :D

    Thank you !

  7. 7 Posted by Mateus Cerqueir... on 10 Dec, 2015 02:03 AM

    Mateus Cerqueira's Avatar

    Sorry for the double post, but i managed to download the log information and attached it in this comment.

    Thanks :)

  8. Support Staff 8 Posted by rune on 13 Dec, 2015 09:01 PM

    rune's Avatar

    Hi,

    Thanks for this and sorry about the slow response here. I noticed that you've been able to successfully build the application since your last messages -- did you figure out a solution to this issue?

    Best,
    Rune

  9. 9 Posted by Mateus Cerqueir... on 14 Dec, 2015 12:48 AM

    Mateus Cerqueira's Avatar

    No, not yet.

    What i did was to push the bower_components folder to the repository and erased the bower command as a workaround. And Gulp worked as expected copying the files from the bower_components folder to the right locations.

    But its kind of wrong push this folder to the repo... So when there is a fix to it i'm gonna remove it.

    I just did this to see if there would be another problem despite bower. But no. That problem downloading some bower packages still happens and is the only remaining problem.

    Would you be able to run the following command on the app machine to see if it fixes?

    git config --global url."https://".insteadOf "git://"

    No problem, take your time.
    Thank you.

  10. Support Staff 10 Posted by rune on 15 Dec, 2015 06:32 PM

    rune's Avatar

    Hi,

    It'd be preferable if we could keep the default git configuration to avoid potentially unnecessary complications down the road. It also doesn't really make any sense to me why configuring it like this should help -- it seems like this configuration is used primarily when the servers are running behind a proxy? There shouldn't be anything stopping git from fetching over the git protocol instead of HTTPS as there's no proxy or outbound firewall.

    Why do you think this would solve the problem? And can you maybe point me to a build/log file that indicates this? The most recent one you sent appears to just fail while setting this configuration setting. By the way, in my comment above I actually meant to say that it likely would not be possible to execute the command with the --global flag (not that it really matter though since it sounds like you've tried with and without).

    Best,
    Rune

  11. 11 Posted by Mateus Cerqueir... on 16 Dec, 2015 11:37 AM

    Mateus Cerqueira's Avatar

    Hello,

    Me and a couple of work colleagues had this same issue in our project (not this one on apphb), working both locally and on the server and the only way we managed to solve this bower package thing was to use this command i showed to you.

    I got a few stackoverflow questions to support my theory:
    http://stackoverflow.com/questions/21789683/how-to-fix-bower-ecmderr
    http://stackoverflow.com/questions/25916640/bower-ecmderr-failed-to...

    As you can see on the second link:
    "This Problem happen because bower proxy configuration, you need to make bower use http:// Instead of git:// when install packages. you can Solve this problem using .bowerrc File."

    When i saw this i tried to config the .bowerrc file all the ways you could've imagined. But a few minutes later i read at the end of the same post:
    "But you must run Command from terminal:

    git config --global url."https://".insteadOf git:// "

    Well, i'm gonna stop quoting posts because it just sounds annoying and i think you got the point. I don't know if you could try to make a special configuration for the .bowerrc file to work on apphb (have no clue if this is possible) or run this command in a "local" manner instead of globally.

    Also i think i've annoyed enough with this problem, so if there is no solution to it or there's nothing to be done left you can say it. No problem at all :)

    Thank you again.

    PS: The log file is attached and you can look for it in my last build as well.
    Commit Id: "2af5e408012a826d4168e1d4b922ccfe57c2e8f1"
    Commit Message: "Reset bower configuration and trying bower build again."

  12. Support Staff 12 Posted by rune on 17 Dec, 2015 04:48 PM

    rune's Avatar

    Hi Mateus,

    You're always welcome to write, and it's not annoying at all -- I certainly appreciate the work you've done while isolating this issue, and your patience while we get this fixed. Let me get back to you shortly when I have some more information to share on the progress!

    Best,
    Rune

  13. 13 Posted by Mateus Cerqueir... on 23 Feb, 2016 03:16 PM

    Mateus Cerqueira's Avatar

    Any progress on this? Is there a way to get bower to work without having to push the 'bower_components' folder to the repo?

    Thanks.

  14. Support Staff 14 Posted by rune on 26 Feb, 2016 05:10 AM

    rune's Avatar

    Hi Mateus,

    Apologies for the lack of updates on this one -- I don't have new information to share at this time unfortunately as part of this is depending on other work that needs to finalized before fully supporting bower. I'll follow up here as soon as I have new information to share!

    Best,
    Rune

  15. Support Staff 15 Posted by rune on 25 May, 2016 04:02 AM

    rune's Avatar

    Hi Mateus,

    Finally have an update on this issue if you're still having trouble running bower: The build servers were recently updated with a slightly newer version of Git, which fortunately included more descriptive error messages and revealed the underlying cause of this (and other related npm/grunt/bower) related issues -- take a look at my response in this thread for a description of the cause and a solution.

    I hope this helps and let me know if it doesn't do the trick for you.

    Best,
    Rune

  16. rune closed this discussion on 25 May, 2016 04:02 AM.

Discussions are closed to public comments.
If you need help with AppHarbor please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac