【问题标题】:gulp-notify error; No reporter specifiedgulp-通知错误;没有指定记者
【发布时间】:2014-03-11 14:55:33
【问题描述】:

我正在使用 Vagrant 和 Puppet 开发一个 Magento 网站来管理我的开发环境。

我使用 Magento Boilerplate 主题 (https://github.com/webcomm/magento-boilerplate) 作为基础,它使用 Gulp.js 来运行 LESS 和 JS 文件的自动编译。

我正在从主机运行 gulp,因为它安装了全套节点、npm 等,但我收到以下错误:

stream.js:94
  throw er; // Unhandled stream error in pipe.
        ^
[gulp] Error in plugin 'gulp-notify': No reporter specified.

主机是 Ubuntu 12.04,来宾是 CentOS。主机安装了所需的 notify-send 包,客户安装了 libnotify,但 gulp 似乎也无法识别。

我以前使用过 Grunt,对 gulp 很陌生,所以这里可能会遗漏一些东西。

【问题讨论】:

    标签: node.js vagrant gulp gulp-less


    【解决方案1】:

    gulp-notify 旨在在带有通知程序的桌面环境中运行。将它放在无头服务器上是没有意义的。

    您可以使用the gulp-if plugin 和the gulp-util library 以及生产/开发标志来防止gulp-notify 在服务器上运行。

    这样设置:

    var _if = require('gulp-if'),
        gutil = require('gulp-util');
    
    var production = gutil.env.production;
    
    //...
    
         // use like so in your pipe:
        .pipe(_if(!production, notify('...')))
    

    然后,像这样在你的服务器上运行它:

    gulp --production
    

    如果您希望谨慎,可以将其反转,以便测试 --dev (gutil.env.dev) 并仅在为 true 时启用它。

    【讨论】:

    • 感谢@OverZealous,如果没有别的我喜欢你处理那里环境的方式。但是,为了回应您的开场评论,我正在从桌面运行 grunt 任务,而不是虚拟机,因为 Vagrant 创建了同步文件夹。如果我取出所有 gulp-notify 引用,则 gulp 任务运行良好。它似乎无法识别我安装的通知发送。
    • 我从未在 vagrant 上测试过 gulp-notify,但这里有一篇关于使用它的博文:jpbetley.com/vagrant-gulp-notifications
    猜你喜欢
    • 1970-01-01
    • 2014-05-12
    • 2014-08-07
    • 2015-10-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-21
    • 1970-01-01
    相关资源
    最近更新 更多