Search code examples
gitbowerfirewallbower-installdd-wrt

Bower install fails with Git ETIMEDOUT package errors and Exit Code #128


Environment:

  • MS Windows 10
  • Node.js v0.12.4
  • Bower v1.65
  • Git v2.63
  • Router DD-WRT v24-sp2 (03/13/14) giga

When I run 'Bower install' from a standard windows command prompt on the project directory I'm getting the following errors for some packages, example below;

Download of https://github.com/angular/bower-angular-sanitize/archive/v1.3.20.tar.gz failed with ETIMEDOUT, retrying in 1.9s

The final error is;

ECMDERR Failed to execute "git ls-remote --tags   --heads git://github.com/angular/bower-angular-sanitize.git", exit code of #128   fatal: unable to connect to github.com: github.com[0: 192.30.252.131]: errno=No   such file or directory

Additional error details:
fatal: unable to connect to github.com:
github.com[0: 192.30.252.130]: errno=No such file or directory

Please note this is not an issue with a specific package.

Is it possible to set/increase the time-out period for Bower/Git?


Solution

  • Allow git.exe through your software firewall.

    I'm using a 3rd party firewall, but you may be using the inbuilt Windows Firewall. I've allowed both inbound and outbound access.

    The location of my git executable is below: - (be sure to replace the username as appropriate);

    C:\Users\USER.NAME\AppData\Local\Programs\Git\cmd\git.exe
    

    If you run 'bower install' again you may see the same ETIMEDOUT errors but the final error may have changed to something like;

    ECMDERR Failed to execute "git ls-remote --tags --heads git://github.com/angular/bower-angular-sanitize.git", exit code of #128 fatal: Unable to look up github.com (port 9418) (No such host is known. )
    

    Allow Git ssh traffic through the router firewall.

    Enter the internal (LAN) IP address, e.g. 192.168.1.1 for your router into a web browser and enter user username and password to login to the DD-WRT Control Panel.

    Go to ADMINISTRATION --> COMMANDS, then add the following code;

    iptables -t filter -A INPUT -p tcp --dport 9418 -j ACCEPT
    iptables -t filter -A OUTPUT -p tcp --dport 9418 -j ACCEPT
    

    Click the SAVE FIREWALL button.

    Finally, go to ADMINISTRATION --> MANAGMENT, then click the REBOOT ROUTER button.

    Give your router some time to reboot, before trying 'Bower install' again.

    Note: I've noticed that 'Bower install' still fails now and again. Sometimes it needs to be run a couple of times before it succeeds (to 'prime' the local Bower cache first perhaps?). IMO Bower install seems to be sensitive to network latency and times-out too quickly.