Gruntjs grunt watch检测到文件更改,但不运行该任务

Gruntjs grunt watch检测到文件更改,但不运行该任务,gruntjs,watch,Gruntjs,Watch,这是我的grunt文件,运行“grunt nj”或“grunt nu”效果很好, “grunt watch-v-d”也可以工作,当文件更改时,终端显示文件更改日志,但根本不运行任务。搜索了很多,没有找到类似的案例或解决方案 var设置=需要('./local')。设置 setting.env='production' module.exports=函数(grunt){ grunt.initConfig({ pkg:grunt.file.readJSON('package.json') ,丑陋的:

这是我的grunt文件,运行“grunt nj”或“grunt nu”效果很好, “grunt watch-v-d”也可以工作,当文件更改时,终端显示文件更改日志,但根本不运行任务。搜索了很多,没有找到类似的案例或解决方案

var设置=需要('./local')。设置
setting.env='production'
module.exports=函数(grunt){
grunt.initConfig({
pkg:grunt.file.readJSON('package.json')
,丑陋的:{
选项:{
横幅:'/*!*/\n'
,报告:['min']
}
,区:{
档案:[{
扩展:正确
,cwd:'public/js/dev'
,src:“*.js”
,dest:'public/js'
}]
}
}
,jade:{
汇编:{
选项:{
数据:设置
}
,档案:[{
扩展:正确
,cwd:‘视图’
,src:“*.jade”
,分机:'.html'
,dest:‘公众’
}]
}
}
,观看:{
js:{
文件:['public/js/dev/*.js']
,任务:['nu']
}
,jade:{
文件:['views/*.jade','views/include/*.jade']
,任务:['nj']
}
}
})
grunt.loadNpmTasks('grunt-contrib-uglify'))
grunt.loadNpmTasks('grunt-contrib-jade')
grunt.loadNpmTasks('grunt-contrib-watch')
grunt.loadNpmTasks('grunt-newer')
grunt.registerTask('nu',['newer:uglify']))
grunt.registerTask('nj',['newer:jade']))
registerTask('default',['newer:uglify','newer:jade']))
}
试试看


任务缺少一个“s”:

,watch: {
  js: {
    files: ['public/js/dev/*.js']
    ,tasks: ['nu']
  }
  ,jade: {
    files: ['views/*.jade', 'views/include/*.jade']
    ,tasks: ['nj']
  }
}

Jade依赖项和更新版本存在类似问题
,watch: {
  js: {
    files: ['public/js/dev/*.js']
    ,tasks: ['nu']
  }
  ,jade: {
    files: ['views/*.jade', 'views/include/*.jade']
    ,tasks: ['nj']
  }
}