gulp-notify错误;没有记者指定

时间:2014-03-11 14:55:34

标签: node.js vagrant gulp gulp-less

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

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

我正在从主机运行gulp,因为它安装了完整的node,npm等套件,但是我收到以下错误:

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

主机是Ubuntu 12.04,Guest是CentOS。主机安装了所需的notify-send软件包,并且guest虚拟机具有libnotify,但gulp似乎也无法识别。

我是gulp的新手,过去曾经使用过Grunt,所以可能会遗漏一些东西。

1 个答案:

答案 0 :(得分:0)

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

您可以使用the gulp-if pluginthe 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

如果您更加谨慎,可以将其反转,以便测试--devgutil.env.dev),并且只有在真实时启用它。