Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bower install without ssl

Tags:

bower

I have trouble connecting to sites with ssl, i.e. https. It can successfully download artifacts from the internet if the url begins with http.

bower install will download dependencies via https. Is there anyway make it download via http?

like image 755
MBehtemam Avatar asked Jan 06 '14 08:01

MBehtemam


2 Answers

I had troubles with this too, and I couldn't find an elegant way to fix it. My workaround was:

  1. Go to your global npm folder and find the "bower" folder (on Windows 7 that is "C:\Users\\AppData\Roaming\npm\node_modules").
  2. In that folder, search the default.js file placed in node_modules\bower-config\lib\util\default.js
  3. Inside that file you will find a "var defaults". Replace the "registry" url property from "https" to "http".

Yes, I know. This shouldn't be done like this, but at least help me to bypass the connection error.

Hope that helps!

like image 136
Juan Manuel Arias Avatar answered Oct 12 '22 13:10

Juan Manuel Arias


You can change the registry used by Bower in the .bowerrc file. The default registry is: https://bower.herokuapp.com and is defined in node_modules/bower-config/lib/util/default.js (as described by Jean Manuel Arias in his answer).

To override for your project, add a value for the registry setting in .bowerrc. An example file might be:

{
    "directory": "<YOUR LIBRARY INSTALL DIRECTORY>",
    "registry":"http://bower.herokuapp.com"
}

In the above example, the default https registry is being overridden with the http version. A full list of the available .bowerrc settings can be found at: Bower Spec.

You can do a global override for the current user by creating a %USERPROFILE%\.bowerrc file (for windows, in Linux it is: ~/.bowerrc). Bower follows a similar search path when applying settings to NPM (see npmrc settings). This is probably a better route as it avoids cluttering your project with local settings.

like image 38
Stephen Simpson Avatar answered Oct 12 '22 14:10

Stephen Simpson