简体   繁体   中英

Grunt “watch” Warning: Path must be a string. Received undefined

Grunt "Watch" doesn't want to proceed.

Problem: Running "watch" task Waiting... Warning: Path must be a string. Received undefined

Here is the grunt watch in Gruntfile.js:

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

  }
},

I found the issue. You need to upgrade grunt-contrib-jshint.

I had version "grunt-contrib-jshint": "~0.9"

changed to "grunt-contrib-jshint": "^1.0.0"

error is now gone!

I figured it out while I wrote this question .


When I added tags for this question I saw the tag grunt-contrib-watch and got to: https://github.com/gruntjs/grunt-contrib-watch .

and did this:

$ npm install grunt-contrib-watch --save-dev

...Now it works. I posted it anyway because I couldn't find something about this when I googled.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM