oru*_*pov 6 node.js gruntjs grunt-contrib-watch
我应该指出我没有经验的用户优先,我的问题是'hostname'属性不能分配任何值,除了空字符串(''),'0.0.0.0'和'localhost'.我得到:致命错误:getaddrinfo ENOTFOUND.我究竟做错了什么?
如果做对了,我可以改变我通常在地址栏中输入的地址,所以改为'localhost'我可以键入'example.com'或类似的东西.
正如我上面提到的,我已经为它分配了不同的值,但只有三个有效.那么为什么这个'*'不起作用.
这是My Gruntfile.js:
module.exports = function( grunt ) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
scripts: {
files: ['*.js'],
options: {
livereload: true
}
},
markup: {
files: ['*.html'],
options: {
livereload: true
}
},
stylesheets: {
files: ['*.css'],
options: {
livereload: true
}
}
},
connect: {
server: {
options: {
hostname: '*',
port: 2000,
base: '.'
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.registerTask('default', ['connect','watch']);
};
Run Code Online (Sandbox Code Playgroud)
在Ubuntu 12.04 64bit上工作
NodeJs 0.10.17
npm 1.3.8
GruntJs 0.4.1
grunt-contrib-connect 0.3.0
dc5*_*dc5 11
这是因为grunt试图将该地址绑定为服务器.无法将服务器绑定到任意IP地址或域名.
| 归档时间: |
|
| 查看次数: |
10277 次 |
| 最近记录: |