简体   繁体   English

如何将Bower Init运行到gulpfile中?

[英]How to run bower init into gulpfile?

I've just used gulp-bower plugin to run bower init in my slush generator. 我刚刚使用了gulp-bower插件在Slush生成器中运行bower init。

bower = require('gulp-bower');

gulp.task('bower', function() {
return bower({cmd: 'init'});
});

But it gives me an error: Register requires an interactive shell. 但这给了我一个错误:注册需要交互式外壳。

bower init requires user interaction. bower init需要用户交互。 Running this command will fail if bower is not configured to run interactively . 如果bower没有配置为交互式运行,则运行此命令将失败。
You can bypass this error by having a .bowerrc file which configures Bower to run interactively: 您可以通过拥有一个.bowerrc文件来绕过此错误,该文件将Bower配置为以交互方式运行:

{
    "interactive": true
}

However you will still need to find a way to provide the required input to the bower init command. 但是,您仍然需要找到一种方法来为bower init命令提供所需的输入。 As far as I've seen the command does not receive any input parameters but expects the input from the user (via STDIN). 据我所知,该命令没有接收任何输入参数,但是希望用户输入(通过STDIN)。
If your intent is to bootstrap a bower.json file, you may want to consider using some kind of templating mechanism instead of running bower init. 如果您打算引导bower.json文件,则可能要考虑使用某种模板机制,而不是运行bower init。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM