Bower install CERT_UNTRUSTED Error - bower

I got the CERT_UNTRUSTED when I tried to run bower install command to install components.
For example, I got this error when I ran the following:
bower install bootstrap-sass-official --save
The output was:
bower error Request to https://bower.herokuapp.com/packages/bootstrap-sass-official failed: CERT_UNTRUSTED
Note: This is not a package specific error. This happens when you try to install any package, not just with bootstrap-sass-official.

you can try setting this in .bowerrc:
{
"directory": "bower_components",
"registry": "http://bower.herokuapp.com",
"strict-ssl": false
}

I found a quick fix for this issue. I guess the issue is happening because of my company's SSL settings.
I changed the registry search as follows (in my windows laptop) and it fixed the issue.
set registry.search=http://bower.herokuapp.com
This should work in unix systems as well, where you have to create a env variable with above key and value.
You can also change the registry setting at .bowerrc file.
You can follow as a quick and dirty fix. Do not make it as a permanent solution.

Related

Bower install from URL gives blank folder

I'm using bower (v. 1.3.5) to pull in my Front-End JS dependencies, and I want to depend on this: https://github.com/dcneiner/Downloadify
It doesn't have its own bower.json so I'm referencing by URL in MY bower.json:
"dependencies": {
"jspdf": "~1.0.272",
"downloadify": "https://github.com/dcneiner/Downloadify.git"
}
But all I get is the named folder containing only a .bower.json file, but none of the code or anything else in the GH repo.
Running bower install directly on the cmd line gave (once I'd cleared out the bower cache):
E:/My/Path>bower install https://github.com/dcneiner/Downloadify.git
bower Downloadify#* not-cached https://github.com/dcneiner/Downloadify.git#*
bower Downloadify#* resolve https://github.com/dcneiner/Downloadify.git#*
bower Downloadify#* checkout 0.2.1
bower Downloadify#* resolved https://github.com/dcneiner/Downloadify.git#0.2.1
bower Downloadify#~0.2.1 install Downloadify#0.2.1
I previously did the same thing with jQuery.fileDownload which worked perfectly, so I don't think it's anything I've done to my machine?
QUESTION:
Have I done something wrong?
Has Downloadify been set up wrong?
Or is it an inexplicable mystery?
In either of the first 2 cases, what is the problem and how do I fix it?
NOTE: Currently I'm working around it by having downloaded the source code manually and having it hard-coded into my project.

Bower install - failed with ETIMEDOUT

When I run bower install, I get the following error:
Request to https://bower.herokuapp.com/packages/jquery failed with
ETIMEDOUT,
retrying in 1.8s
But when I run the same URL in the address bar of Chrome, I get the json. I don't know why it fails when I do bower install using Windows 7 command shell. I suspect it has got something to do with my workplace's proxy settings.
Anyone?
Try edit .bowerrc
"proxy":"http://<host>:<port>",
"https-proxy":"http://<host>:<port>",
"strict-ssl": false
Have you tried something like http_proxy='proxyserver' https_proxy='proxyserver' bower install? (where proxyserver is your proxy)
Getting error related to proxy when no proxy is configured: May be npm is picking up proxy.
Delete the proxy attribute from npm config and try. Use:
npm config delete proxy
This solved my problem.
You need to set the new registry for bower in .bowerrc:
{
"registry": "https://registry.bower.io"
}
The old url https://bower.herokuapp.com/ is no more available.
In my case (Win7), this problem was fixed by providing bower with the proxy settings.
As #Robert Moon mentioned in his answer, you can place this settings in the .bowerrc file.
For proxies that require authentication you will need to provide it as follows:
http://domain\username:password#proxyserverurl:port
The back slash is particularly tricky since it needs to be escaped in the .bowerrc file
Example .bowerrc:
{
"directory": "bower_components",
"proxy": "http://domain%5Cusername:password#proxyserverurl:port",
"https-proxy": "http://domain%5Cusername:password#proxyserverurl:port",
"no-proxy":"localserver.domain.com"
}
The official documentation from Bower that mentions proxy settings:
https://bower.io/docs/config/#bowerrc-specification
I was also stuck with the same error. The following steps fixed the error for me:
Remove any existing proxy: npm config delete proxy
Then set proxy using: npm config set proxy http://<host>:<port>
You may also need to change the proxy settings for git:
git config --global http.proxy http://<host>:<port>
Now edit the .bowerrc file as described by Robert Moon
"proxy":"http://<host>:<port>",
"https-proxy":"http://<host>:<port>",
"strict-ssl": false
Prod server build bower well, but the develop server does not build, it is stop with ETIMEDOUT.
The error went through when I added:
"timeout": 120000
into .bowerrc.
Info from page https://bower.io/docs/config/ helped me.

Stop bower from asking for statistics when installing

I'm trying to set up an automated package build for an app which uses bower. When it gets to bower install in the postinstall, bower prompts:
[?] May bower anonymously report usage statistics to improve the tool
over time? (Y/n)
This is screwing up the automated scripts. I could write an expect script to deal with this but I'd rather not if I don't have to. Is there a way to get it to shut up?
As was noted in a comment, this was raised as an issue at github. At the end of that issue there's reference to a minor note at the end of the CHANGELOG comments:
NOTE: It's advisable that users use --config.interactive=false on automated scripts.
You can create a ~/.bowerrc file, which is useful when using bower to install components in a Docker environment:
{
"interactive": false
}
Another option is setting an environment variable (source):
export CI=true
It seems that you could use
bower --config.analytics=false install
to disable only Analytics question.
#see https://github.com/bower/bower/pull/1470
In addition to the existing answers, note that when you are running bower from grunt (e.g. with grunt bower-install-simple, you'll have to add this not into any .bowerrc file, but into the Gruntfile.js. I recently added this line to prevent our CI getting stuck due to unresolvable dependencies:
grunt.initConfig({
...,
/**
* Downloads and installs library dependencies via bower
* defined in bower.json.
*/
'bower-install-simple': {
options: {
...,
+ interactive: false
}
}
});
General way to bypass input for most commands: yes.
yes | bower install
yes | grunt build

Bower not copying any files

Im using bower as part of the yeoman 1.0 beta 4 install. All looks well however when I run bower install I get the expected output yet no files are copied to app/components as advertised.
I am running on windows which I understand is not officially supported yet. Has any one managed to get this up and running with some success? I have followed some tutorials on line relating to the subject however I think they are out dated. I managed to install yeoman without any additional steps and no errors as far as I can tell.
Grunt File being Used
Oh no... Git was not on the system path. Adding it caused me to run into another small error with a solution found here http://wingkaiwan.com/2012/11/25/bower-errors-on-windows/
Thank you Mr Ricky Wan

Choose bower install directory

This is a follow-up to this question. I'm using bower 0.7.1, and still cannot get the components to be installed anywhere else than in the components folder.
I tried adding the following line to my component.json, as per this PR:
"componentsDirectory": "public/components"
But it will still install in ./components.
I tried to create a .bowerrc file next to component.json:
{
"directory" : "public/components"
}
But I get this error when running bower install:
Error: Unable to parse local .bowerrc file: Unexpected token }
Any idea?
Actually the .bowerrc file does work, this was an issue with my IDE not saving the file properly:
{
"directory" : "public/components"
}
I'm still wondering why componentsDirectory still doesn't work in component.json, though.
While you can happily use Bower to manage the dependencies of your own personal projects, primarily the component.json is a description of your project for other people. If you share a component through the Bower registry the component.json goes with it to describe the dependencies. That is why your own local preferences like where to install components don't belong in there.
Another way to change installation directory temporarily is using --config option in command line:
bower install jquery --config.directory=/path/to/your/components
If you are creating this file in Notepad++, make sure the Encoding is set to "Encode in UTF-8 without BOM" and save as file type "Any".

Resources