鍍金池/ 問答/Java  HTML/ Grunt 啟動后報錯Warning: Task "default&q

Grunt 啟動后報錯Warning: Task "default" not found.實在找不到問題出在哪?麻煩幫一下忙

今天學(xué)習(xí)grunt,在配置好之后啟動出現(xiàn)一下問題:

Loading "gruntfile.js" tasks...ERROR
>> SyntaxError: Unexpected token .
Warning: Task "default" not found. Use --force to continue.

Aborted due to warnings.

我的gruntfile.js

'use strict'
module.exports = function(grunt){
    grunt.initConfig({
        // watch的配置
        watch : {
            jade :{
                files : ['views/**'],
                options : {
                    livereload : true
                }
            },
            js : {
                files : ['page/**'],
                options : {
                    livereload : true
                }
            }
        },
        nodemon : {
            dev : {
                script : 'app.js',
                options : {
                    args : [],
                    nodeArgs : ['--debug'],
                    ignore : ['README.md', 'node_modules/**', '.DS_Store'],
                    ext : 'js',
                    watch : [./],
                    delay : 1000,
                    env : {
                        PORT : '3000'
                    },
                    cwd : __dirname
                }
            }
        },
        concurrent : {
            tasks : ['nodemon','watch'],
            options : {
                logConcurrentOutput : true
            }
        }

    }); 

    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-nodemon');
    grunt.loadNpmTasks('grunt-concurrent');
    
    grunt.option('force', true);
    grunt.registerTask('default', ['concurrent']);
}

package.json

{
  "name": "myblog",
  "version": "1.0.0",
  "description": "",
  "main": "app.js",
  "dependencies": {
    "bootstrap": "^3.3.7",
    "express": "^4.16.3",
    "grunt": "^1.0.2",
    "grunt-contrib-watch": "^1.0.1",
    "jade": "^1.11.0",
    "serve-static": "^1.13.2",
    "wangeditor": "^3.1.1"
  },
  "devDependencies": {
    "grunt-concurrent": "^2.3.1",
    "grunt-nodemon": "^0.4.2"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

格式括號等問題我都排查了好幾遍,然后里面運用到的3個組件都分別去查看了相關(guān)文檔,也在Stack Overflow查了相關(guān)的問題,但是那些解答都非常私人化.哪位大大可以幫忙排查一下.

回答
編輯回答
醉淸風(fēng)

你的這個文件我用VSCode打開就有報錯了。 27行的watch : [./],應(yīng)該是watch : ["./"],

建議你給你的編輯器配置下語法檢查插件,比如ESlint。

2018年2月18日 17:12