VS 2015 + Bower: Does not work behind firewall

前端 未结 12 2164
一向
一向 2020-11-29 01:40

Problem

In Visual Studio 2015, using bower, my package restores fail when behind a firewall with an error similar to:

ECMDERR Failed to exec

相关标签:
12条回答
  • 2020-11-29 02:40

    The solution that worked for me with VS2015 Release is to :

    1. Install git command line tool.
    2. Modify the file C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\External\bower.cmd with this content:

      set PATH=C:\Program Files (x86)\Git\bin\;%PATH%
      git config --global url."http://".insteadOf git://
      git config -l
      @"%~dp0\node\node" "%~dp0\bower\node_modules\bower\bin\bower" %*
      
    0 讨论(0)
  • 2020-11-29 02:40

    The easiest answer which definitely works is here. I had a big headache with this issue. Just download git and install it. While installing choose this option. Run Git from the windows command prompt

    0 讨论(0)
  • 2020-11-29 02:44

    Microsoft's version of git that is installed (at least with VS2015 Update 1) does honor the .gitconfig file, but the tooling that is installed by default does not give you a way to manipulate it (like all the other answers show using git config to fix the problem).

    To fix the problem without any extra installations and whatnot, simply create a .gitconfig file in C:\Users\YourUserName and put this content in there (which is the content that git config --global would do but since you dont have a git.exe that can change config, you cannot use that without installing something else you do not really need)

    
        [url "https://github.com/"]
            insteadOf = git@github.com:
        [url "https://"]
            insteadOf = git://
    
    
    0 讨论(0)
  • 2020-11-29 02:44

    I had the same problem in Visual Studio 2015 RC (not CTP) and got resolved.

    The bower.cmd in 2015 RC does not work well so I needed to disable it in my VS and use the official one installed on my PC. It is easy to do it just right click "Bower" folder in the project and select "configure external tools" then uncheck the section "$(DevEnvDir)\Extensions\Microsoft\Web Tools\External\git".

    You may also need to change ".bowerrc" file to make GIT working in the right path for you project.

    After doing this, everything works as expected.

    0 讨论(0)
  • 2020-11-29 02:44

    I had this same problem in Visual Studio 2015 RC (not CTP). Since this is the only relevant thread I found anywhere, figured I'd add my 2c here.

    Expanding on @MagicMau's answer, the lines in bower.cmd referenced don't exist in 2015 RC, so I took a different approach and set the PATH env variable, so that my entire bower.cmd file now looks like this:

    set PATH=C:\Program Files (x86)\Git\bin\;%PATH%
    @"%~dp0\node\node" "%~dp0\bower\node_modules\bower\bin\bower" %*
    

    Note that the first line is what I added, and the second line was the existing content.

    The first time I did this, Visual Studio crashed during package restore, but seems to be working after a restart of VS.

    0 讨论(0)
  • 2020-11-29 02:47

    With VS 2015, Update 2 : Just install Git

    http://git-scm.com/

    0 讨论(0)
提交回复
热议问题