我的 app.js 文件代码(Node JS)
var http = require('http'),
fs = require('fs');
fs.readFile('./index.html', function (err, html) {
if (err) {
throw err;
}
http.createServer(function(request, response) {
response.writeHeader(200, {"Content-Type": "text/html"});
response.write(html);
response.end();
}).listen(8000);
});
我的 Gruntfile.js
module.exports = function (grunt) {
grunt.initConfig({
reload: {
port: '8000',
proxy: {
host: 'localhost'
}
},
watch:{
files:['index.html'],
tasks:['reload']
}
});
grunt.loadNpmTasks('grunt-reload');
grunt.registerTask('default', ['reload']);
};
当节点上命令 grunt giv 错误时
代理 [//localhost:80/] 重新加载在 [//localhost:8000] 运行的服务器 致命错误:监听 EADDRINUSE
当节点关闭时 Grund 命令
运行“重新加载”任务代理 [//localhost:80/] 重新加载在 [//localhost:8000] 运行的服务器
完成,没有错误。
但文件没有重新加载。