Proxy Server interference running Bower in Yeoman Ionic installation

Here’s some bizarre behavior. Installing “yo ionic” at the Santa Monica Library, I got Bower run errors because the library is using a proxy server that does not allow the default port that the git:// protocol uses. This was the same issue I was having running Git and Bower standalone. The difference is that Yeoman Ionic generator does a variety of build and installation tasks before launching Bower to install client javascript libraries.

The way I normally get around that is to set the local Git “config” file to use the https:// rather than the git:// protocol with the command

$ git config url."https://".insteadOf git://

You first want to create a “.git” folder with an empty “config” file in it to enable the command to write to it.

Unfortunately, the Yeoman “$ yo ionic” command refuses to accept a directory that is NOT EMPTY (i.e., has a “.git” folder in it) when it is installing Cordova plugins early in the Yeoman process.

Installing selected Cordova plugins, please wait.
{ [CordovaError: Current working directory is not a Cordova-based
project.]
name: 'CordovaError',
message: 'Current working directory is not a Cordova-based
project.' }
× Please run `yo ionic` in an empty directory, or in that of
an already existing cordova project.

So I created that /.git/config folder/file and then COPIED IT OVER AFTER Cordova installation and BEFORE “yo ionic” starts to run npm and bower to install dependencies. Since Bower comes after Npm, which takes a long time, there is time for the copy. That is completely mickey mouse. But the alternative is to set Git to use https:// globally using the –global flag in the above Git command. But some people don’t want to do that, although it should do no harm (you can “unset” the config).

You could also let the Yeoman generator fail its final Bower install stage and THEN create and set the /.git/config file and run Bower ($ bower install ) afterwards.

Advertisements