Error runnning on Windows 8
Closed this issue · 14 comments
gulp-notify: [Error running notifier] Could not send message: Command failed:
Exception non g�r�e�: System.Exception: Exception de HRESULT : 0xC00CE508
� Windows.UI.Notifications.ToastNotifier.Show(ToastNotification notification)
� toast.Program.ShowToast(String title, String message, String imageURI, Boolean sound)
� toast.Program.Main(String[] args)
Hm. This seems to be an issue with Toaster (https://github.com/nels-o/toaster). Is this an error that occurs often?
It occurs every time. It might be because there is to much data passed in the notification.
Do you have any data I can use to reproduce this?
The gulp task :
'use strict';
var gulp = require('gulp');
var jscs = require('gulp-jscs');
var notify = require('gulp-notify');
/**
* JSCS task
*/
gulp.task('jscs', function() {
return gulp.src('./**.js')
.pipe(jscs())
.on('error', notify.onError({
title : 'JSCS error(s)',
message : '<%= error.message %>'
}));
});
On this file (as an example)
/**
* Gruntfile
*
* This Node script is executed when you run `grunt` or `sails lift`.
* It's purpose is to load the Grunt tasks in your project's `tasks`
* folder, and allow you to add and remove tasks as you see fit.
* For more information on how this works, check out the `README.md`
* file that was generated in your `tasks` folder.
*
* WARNING:
* Unless you know what you're doing, you shouldn't change this file.
* Check out the `tasks` directory instead.
*/
module.exports = function(grunt) {
// Load the include-all library in order to require all of our grunt
// configurations and task registrations dynamically.
var includeAll;
try {
includeAll = require('include-all');
} catch (e0) {
try {
includeAll = require('sails/node_modules/include-all');
}
catch(e1) {
console.error('Could not find `include-all` module.');
console.error('Skipping grunt tasks...');
console.error('To fix this, please run:');
console.error('npm install include-all --save`');
console.error();
grunt.registerTask('default', []);
return;
}
}
/**
* Loads Grunt configuration modules from the specified
* relative path. These modules should export a function
* that, when run, should either load/configure or register
* a Grunt task.
*/
function loadTasks(relPath) {
return includeAll({
dirname: require('path').resolve(__dirname, relPath),
filter: /(.+)\.js$/
}) || {};
}
/**
* Invokes the function from a Grunt configuration module with
* a single argument - the `grunt` object.
*/
function invokeConfigFn(tasks) {
for (var taskName in tasks) {
if (tasks.hasOwnProperty(taskName)) {
tasks[taskName](grunt);
}
}
}
// Load task functions
var taskConfigurations = loadTasks('./tasks/config'),
registerDefinitions = loadTasks('./tasks/register');
// (ensure that a default task exists)
if (!registerDefinitions.default) {
registerDefinitions.default = function (grunt) { grunt.registerTask('default', []); };
}
// Run task functions to configure Grunt.
invokeConfigFn(taskConfigurations);
invokeConfigFn(registerDefinitions);
};
@rvlander
Try running your terminal with admin level at least once. I've had exactly the same problem (and the same output error) before I've run my console with admin level. After running gulp-notify in process with admin level I had never seen that problem again.
Cool. I haven't gotten this reproduced yet, so if this fixes the issue that would be great!
Sadly, it does not solve the issue.
Could it be due to console colours? I had a similar issue with gulp-typescript error handling, the error object was created with the message having embedded colour codes that caused the exact same error message. I resolved it by stripping the colours:
var chalk = require('chalk');
js = result.js
.on('error', function (error) {
notify.onError({
title: "Typescript compilation error",
message: chalk.stripColor(error.message)
})(error);
})
I could (thank god) change my employers' mind and know I am allowed to use Archlinux. I won't be able to test it under windows anymore.
Sorry.
Running terminal with admin level has solved issue for me 👍
thanks @peterblazejewicz
Great! I've never noticed this issue as I always run with admin access (due to attaching debugger to iis process)
Hi!
I got the same problem and launch the command in admin doesn't solve the problem. : /
@mikaelbr Ok, I think I got it: the ecape char made this error.
I added this lines to my code:
var = isWin = /^win/.test(process.platform);
function escape(string) {
return isWin ? string.replace(/\x1b/g, '') : string;
}
But it breaks colors in terminal.
Thanks. It might seem as the message given into the plugin has terminal colours, which crashes toaster. It's safe to filter this as toaster doesn't support these kind of colours anyways (not any notification system does), so it should be safe to filter it in any case.
I'll look into it as soon as I can, but patches are welcome. I think just filtering the message/title before sending it to node-notifier
should suffice.