53

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?

jsd
  • 7,673
  • 5
  • 27
  • 47
  • 1
    It's being discussed here: https://github.com/bower/bower/issues/1102 – afj176 Mar 15 '14 at 18:52
  • I've got the same problem, but I can't type Y or N to answer the question in PowerCmd, or in the native windows command prompt. Anyone else have this problem? Or should this be a new question? – mtpultz Jun 23 '14 at 04:31

5 Answers5

62

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.

Christopher Currie
  • 3,025
  • 1
  • 29
  • 40
25

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
blueyed
  • 27,102
  • 4
  • 75
  • 71
  • 3
    The problem on using this on the bowerrc is that also you wont have a prompt whenever you install something and you need to resolve a conflict with versions for example. – fernandopasik Aug 08 '14 at 03:20
9

It seems that you could use

bower --config.analytics=false install

to disable only Analytics question.

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

Oliboy50
  • 2,661
  • 3
  • 27
  • 36
0

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
         }
     }
 });
Paŭlo Ebermann
  • 73,284
  • 20
  • 146
  • 210
0

General way to bypass input for most commands: yes.

yes | bower install
yes | grunt build
Justin
  • 9,419
  • 7
  • 34
  • 41