当我的快速配置的grunt模块load-grunt-config
时,我得到No "express" targets found.
。我用grunt load-grunt-config --config-debug
澄清它正确找到它。我究竟做错了什么?
DEBUG:
one@node ~/github/simple-load-balancer-service/lbs $ grunt load-grunt-config --config-debug
{
"express": {
"prod": {
"options": {
"port": 9000,
"script": "app.js"
}
}
},
"package": {
"name": "app",
"description": "simple-angular",
"version": "0.0.1",
"dependencies": {
"express": "4.x",
"express-multi-proxy-router": "*",
"body-parser": "*"
},
"devDependencies": {
"grunt": "latest",
"testem": "latest",
"jasmine": "latest",
"phantomjs": "latest",
"load-grunt-tasks": "latest",
"load-grunt-config": "latest",
"grunt-bower-install": "latest",
"grunt-contrib-watch": "latest",
"grunt-contrib-connect": "latest",
"grunt-express-server": "latest",
"grunt-open": "latest",
"grunt-contrib-coffee": "latest",
"grunt-contrib-less": "latest",
"grunt-injector": "latest",
"grunt-testem": "latest",
"grunt-bowercopy": "latest",
"grunt-reload": "latest"
}
}
}
咕噜/ express.js“
one@node ~/github/simple-load-balancer-service/lbs $ cat grunt/express.js
module.exports = {
prod: {
options: {
port: 9000,
script: 'app.js',
}
}
};
Gruntfile.js:
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
require('load-grunt-config')(grunt);
grunt.initConfig({
//Todo: clean up file path directives
watch: {
express: {
files: ['app/static/**',
'app/scripts/**',
'app.js'],
tasks: ['express:prod'],
options: {
spawn: false,
livereload: true
}
},
files: ['app/static/**',
'app/scripts/**',
'app.js'],
tasks: ['reload'],
}
});
grunt.registerTask('default', 'start server', function() {
grunt.task.run('express');
// Uncomment grunt.task.run('open') if you plan on running on running on
// just 127.0.0.1 rather than all interfaces 0.0.0.0
//grunt.task.run('open');
//grunt.task.run('bowerInstall');
//grunt.task.run('coffee');
//grunt.task.run('less');
//grunt.task.run('injector');
grunt.task.run('watch');
});
}