我安装了grunt-notify以在桌面上获取消息。
这是 Gruntfile.js :
module.exports = function(grunt) {
grunt.initConfig({
notify: {
test: {
options: {
message: "YO"
}
}
}
});
grunt.loadNpmTasks('grunt-notify');
// simplified example
grunt.registerTask('default', ['notify:test']);
};
控制台输出开启grunt -v
E:\Temp>grunt -v
Initializing
Command-line options: --verbose
Reading "Gruntfile.js" Gruntfile...OK
Registering Gruntfile tasks.
Initializing config...OK
Registering "grunt-notify" local Npm module tasks.
Reading E:\Temp\node_modules\grunt-notify\package.json...OK
Parsing E:\Temp\node_modules\grunt-notify\package.json...OK
Loading "notify.js" tasks...OK
+ notify
Loading "notify_hooks.js" tasks...OK
+ notify_hooks
Loading "Gruntfile.js" tasks...OK
+ default
No tasks specified, running default tasks.
Running tasks: default
Running "default" task
Running "notify:test" (notify) task
Verifying property notify.test exists in config...OK
File: [no files]
Options: title="Temp", message="YO"
>> [grunt-notify] growl: C:\Utils\growlnotify\growlnotify.COM
>> [growl] cmd: growlnotify
>> [growl] args: /i:E:\Temp\node_modules\grunt-notify\images\grunt-logo.png YO /t:Temp
>> [growl] return_code: 4294967295
Done, without errors.
我们可以看到一个return_code: 4294967295
(-1 转换为无符号 32 位值)。.
如果我手动执行以下命令行:E:\Temp>growlnotify /i:E:\Temp\node_modules\grunt-notify\images\grunt-logo.png YO /t:Temp
我收到了消息(没有徽标):
那么,为什么我在通过 grunt-notify 传递时得到错误代码,而不是在手动行命令上?
注意:我使用的是 Windows 7 Pro
编辑:关注此问题后:https ://github.com/dylang/grunt-notify/issues/91 ,我成功地使用命令行获取图像:
C:\temp>growlnotify /i:"C:/temp/node_modules/grunt-notify/images/grunt-logo.png" "YO" /t:temp
但仍然无法通过 grunt...