Stop bower from asking for statistics when installing

Bower

Bower Problem Overview


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?

Bower Solutions


Solution 1 - Bower

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.

Solution 2 - Bower

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

Solution 3 - Bower

It seems that you could use

bower --config.analytics=false install

to disable only Analytics question.

@see https://github.com/bower/bower/pull/1470

Solution 4 - Bower

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
         }
     }
 });

Solution 5 - Bower

General way to bypass input for most commands: yes.

yes | bower install
yes | grunt build

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionjsdView Question on Stackoverflow
Solution 1 - BowerChristopher CurrieView Answer on Stackoverflow
Solution 2 - BowerblueyedView Answer on Stackoverflow
Solution 3 - BowerOliboy50View Answer on Stackoverflow
Solution 4 - BowerPaŭlo EbermannView Answer on Stackoverflow
Solution 5 - BowerJustinView Answer on Stackoverflow