LearnBoost/stylus — Issue #583: It looks like growl.notify() is crashing Stylus?
Author: dylan
Created: 2012-02-22 18:34:05+00:00
State: open

Whenever I am watching a file/folder and I have any sort of stylus compile error, things crap out when it comes time to throw a growl notification. I've checked NPM to make sure that I dont have a new version of growl or something strange.

I'm running **node v0.6.11**, **npm 1.1.1**, **stylus 0.24.0**, and I also have the latest growlnotify. I've also uninstalled growlnotify, to see if it would detect that and not try and throw a growl...

watching styl/grid/grid.styl
watching styl/buttons.styl
Error: styl/sub-tool-table.styl:66
62|	input[type="text"]
63|	margin-top: 2px
64|	line-height: 20px
65|	margin-right: 10px
> 66|

Failed to @extend ".button-delete"

at /usr/local/lib/node_modules/stylus/lib/visitor/normalizer.js:158:24
at Array.forEach (native)
at Normalizer.extend (/usr/local/lib/node_modules/stylus/lib/visitor/normalizer.js:156:17)
at Normalizer.visitGroup (/usr/local/lib/node_modules/stylus/lib/visitor/normalizer.js:137:8)
at Normalizer.visit (/usr/local/lib/node_modules/stylus/lib/visitor/index.js:28:39)
at Normalizer.visitBlock (/usr/local/lib/node_modules/stylus/lib/visitor/normalizer.js:110:19)
at Normalizer.visit (/usr/local/lib/node_modules/stylus/lib/visitor/index.js:28:39)
at Normalizer.visitGroup (/usr/local/lib/node_modules/stylus/lib/visitor/normalizer.js:139:22)
at Normalizer.visit (/usr/local/lib/node_modules/stylus/lib/visitor/index.js:28:39)
at Normalizer.visitBlock (/usr/local/lib/node_modules/stylus/lib/visitor/normalizer.js:110:19)

/usr/local/lib/node_modules/stylus/bin/stylus:509
growl && growl.notify(err.message, { title: 'Stylus error' });
^
TypeError: Object function growl(msg, options, fn) {
var image
, args = [cmd.pkg]
, options = options || {}
, fn = fn || function(){};

// noop
if (!cmd) return fn(new Error('growl not supported on this platform'));

// image
if (image = options.image) {
switch(cmd.type) {
case 'Darwin':
var flag, ext = path.extname(image).substr(1)
flag = flag || ext == 'icns' && 'iconpath'
flag = flag || /^[A-Z]/.test(image) && 'appIcon'
flag = flag || /^png|gif|jpe?g$/.test(ext) && 'image'
flag = flag || ext && (image = ext) && 'icon'
flag = flag || 'icon'
args.push('--' + flag, image)
break;
case 'Linux':
args.push('-i ' + image);
break;
}
}

// sticky
if (options.sticky) args.push(cmd.sticky);

// priority
if (options.priority) {
var priority = options.priority + '';
var checkindexOf = cmd.priority.range.indexOf(priority);
if (~cmd.priority.range.indexOf(priority)) {
args.push(cmd.priority, options.priority);
}
}

// name
if (options.name && cmd.type === "Darwin") {
args.push('--name', options.name);
}

switch(cmd.type) {
case 'Darwin':
args.push(cmd.msg);
args.push('"' + msg + '"');
if (options.title) args.push(options.title);
break;
case 'Linux':
if (options.title) {
args.push("'" + options.title + "'");
args.push(cmd.msg);
args.push("'" + msg + "'");
} else {
args.push("'" + msg + "'");
}
break;
}

// execute
exec(args.join(' '), fn);
} has no method 'notify'
at /usr/local/lib/node_modules/stylus/bin/stylus:509:30
at Renderer.render (/usr/local/lib/node_modules/stylus/lib/renderer.js:86:5)
at /usr/local/lib/node_modules/stylus/bin/stylus:504:15
at [object Object]. (fs.js:115:5)
at [object Object].emit (events.js:64:17)
at afterRead (fs.js:1112:12)
at Object.wrapper [as oncomplete] (fs.js:254:17)