请问,我在启动grunt concurrent的时候遇到报错:No "concurrent" targets found;
我之前已经用npm下载好了,并且在Gruntfile.js里使用:grunt.loadNpmTasks('grunt-concurrent');载入插件。
请问,我在启动grunt concurrent的时候遇到报错:No "concurrent" targets found;
我之前已经用npm下载好了,并且在Gruntfile.js里使用:grunt.loadNpmTasks('grunt-concurrent');载入插件。
2014-09-24
这是完整的配置代码:
module.exports = function(grunt) {
grunt.initConfig({
watch: {
jade: {
files: ['views/**'],
options: {
livereload: true
}
},
js: {
files: ['public/js/**', 'models/**/*.js', 'schemas/**/*.js'],
//tasks: ['jshint'],
options: {
livereload: true
}
},
uglify: {
files: ['public/**/*.js'],
tasks: ['jshint'],
options: {
livereload: true
}
},
styles: {
files: ['public/**/*.less'],
tasks: ['less'],
options: {
nospawn: true
}
}
},
jshint: {
options: {
jshintrc: '.jshintrc',
ignores: ['public/libs/**/*.js']
},
all: ['public/js/*.js', 'test/**/*.js', 'app/**/*.js']
},
less: {
development: {
options: {
compress: true,
yuicompress: true,
optimization: 2
},
files: {
'public/build/index.css': 'public/less/index.less'
}
}
},
uglify: {
development: {
files: {
'public/build/admin.min.js': 'public/js/admin.js',
'public/build/detail.min.js': [
'public/js/detail.js'
]
}
}
},
nodemon: {
dev: {
options: {
file: 'app.js',
args: [],
ignoredFiles: ['README.md', 'node_modules/**', '.DS_Store'],
watchedExtensions: ['js'],
watchedFolders: ['./'],
debug: true,
delayTime: 1,
env: {
PORT: 3000
},
cwd: __dirname
}
}
},
mochaTest: {
options: {
reporter: 'spec'
},
src: ['test/**/*.js']
},
concurrent: {
tasks: ['nodemon', 'watch', 'less', 'uglify', 'jshint'],
options: {
logConcurrentOutput: true
}
}
})
grunt.loadNpmTasks('grunt-contrib-watch')
grunt.loadNpmTasks('grunt-nodemon')
grunt.loadNpmTasks('grunt-concurrent')
grunt.loadNpmTasks('grunt-mocha-test')
grunt.loadNpmTasks('grunt-contrib-less')
grunt.loadNpmTasks('grunt-contrib-uglify')
grunt.loadNpmTasks('grunt-contrib-jshint')
grunt.option('force', true)
grunt.registerTask('default', ['concurrent'])
grunt.registerTask('test', ['mochaTest'])
}我已经按照你的方法执行了,但报错还是存在。
这是我的Gruntfile.js配置内容:
module.exports = function(grunt) {
grunt.initConfig({
watch : (省略),
nodemon : (省略),
concurrent: {
target: {
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']);
}但是不管我在npm里执行grunt,还是grunt concurrent。都报错No "concurrent" targets found.
举报