编程语言
首页 > 编程语言> > javascript – Grunt“watch”警告:路径必须是一个字符串.收到undefined

javascript – Grunt“watch”警告:路径必须是一个字符串.收到undefined

作者:互联网

Grunt“Watch”不想继续.

问题:
运行“观察”任务
等候…
警告:路径必须是字符串.收到undefined

这是Gruntfile.js中的grunt手表:

watch: {
  //Watch files for changes during "grunt serve"
  main: {
    options: {
        livereload: true,
        livereloadOnError: false,
        spawn: false
    },
    files: [createFolderGlobs(['*.js', '*.less','*.html','*.json']), '!src/bower_components/**/*.js', '!src/js/**/*.js', '!_SpecRunner.html','!.grunt'],
    tasks: [] //all the tasks are run dynamically during the watch event handler

  }
},

解决方法:

我发现了这个问题.您需要升级grunt-contrib-jshint.

我有版本“grunt-contrib-jshint”:“~0.9”

改为“grunt-contrib-jshint”:“^ 1.0.0”

错误现在消失了!

标签:javascript,gruntjs,grunt-contrib-watch
来源: https://codeday.me/bug/20190717/1488653.html