Open dmhendricks opened 5 years ago
Have the same issue.
[Error in notifier] SyntaxError in plugin "gulp-notify"
Same:
[15:56:02] gulp-notify: [Error in notifier] SyntaxError in plugin "gulp-notify" Message: Unexpected token { in JSON at position 133
Same issue here as well:
[15:48:55] gulp-notify: [Error in notifier] SyntaxError in plugin "gulp-notify" Message: Unexpected token { in JSON at position 129
Same here:
[21:03:20] gulp-notify: [Error in notifier] SyntaxError in plugin "gulp-notify" Message: Unexpected token { in JSON at position 129
Same here. Any thoughts?
Same here, any thoughts when it might be fixed? Thanks.
Use double quotes and pass your object as JSON(quotes around your properties):
notify({
"title": "Gulp Task Complete",
"message": "Message"
})
@mahammedzkhan Thanks for your hint, it helped.
Hi!
I also ran into this error and tried to debug it a little bit. I was able to reproduce it using this script:
cp = require('child_process');
cmd = '/usr/local/lib/node_modules/node-notifier/vendor/mac.noindex/terminal-notifier.app/Contents/MacOS/terminal-notifier';
options = [
'-title', '"Hello from mgaw"',
'-message', '"Trying to trigger invalid JSON"',
'-hint', '"int:transient:1"',
'-timeout', '"1"',
'-json', '"true"'
];
x = () => {
process = cp.execFile(cmd, options, (err, stdout, stderr) => {
console.log('--- Response on stdout that should be valid JSON:\n' + stdout + '\n---\n');
});
console.log('Triggered notification, waiting for it to time out...');
}
range = n => [...Array(n).keys()];
range(10).forEach(x);
When I run it, often I will see this response, which I guess is the expected valid JSON:
{
"activationType" : "timeout",
"activationAt" : "2019-07-12 14:44:33 +0200",
"deliveredAt" : "2019-07-12 14:44:32 +0200"
}
However sometimes two (or more) of those responses are concatenated together in a response such as:
{
"activationType" : "timeout",
"activationAt" : "2019-07-12 14:44:33 +0200",
"deliveredAt" : "2019-07-12 14:44:31 +0200"
}{
"activationType" : "timeout",
"activationAt" : "2019-07-12 14:44:33 +0200",
"deliveredAt" : "2019-07-12 14:44:31 +0200"
}
The SyntaxError happens when gulp-notify tries to parse this response.
This was using version 1.7.2
of terminal-notifier:
$ /usr/local/lib/node_modules/node-notifier/vendor/mac.noindex/terminal-notifier.app/Contents/MacOS/terminal-notifier
terminal-notifier (1.7.2) is a command-line tool to send OS X User Notifications.
@mgaw I was seeing the same behavior while trying to debug this on my machine as well. terminal-notifier v1.7.2 npm v6.10.1 node v12.4.0 macOS v10.14.5
I had the same problem just now but the solution @mahammedzkhan mentioned works fine.
@mahammedzkhan Dunno why - after your solution there were few notifications, and then gulp-notify
broken completely. I guess this issue somehow related to vendored terminal-notifier
, as OSX version works just OK.
Hi,
Has there been any resolve on this at all? I am coming up against this issue.
Using Gulp Notify 4.0.0 Node : 20.6.1
Thanks in advance
Use double quotes and pass your object as JSON(quotes around your properties):
notify({ "title": "Gulp Task Complete", "message": "Message" })
Hi,
Have you tested this in even later versions of node? Definitely seems as if this plugin is not going to be supported anymore as later versions total fail with the notification system.
I have gotten the error, "SyntaxError in plugin 'gulp-notify'" with various projects with which I use
gulp-notify
. I have Gulp logging errors to the console:I'd like to keep logging errors to the console, but I'd rather not get these errors. Full text of the error:
Thank you for the plugin! Daniel