Gruntjs:致命错误:getaddrinfo ENOTFOUND
我应该指出,我是没有经验的用户第一,我的问题是, '主机名'属性不能有任何值分配除空string(''),'0.0.0.0'和'本地主机'。 我得到: 致命错误:getaddrinfo ENOTFOUND 。 我究竟做错了什么?
如果得到它的权利,我可以改变我通常在地址栏中input的地址,所以,而不是'localhost'我可以键入'example.com'或类似的东西。
正如我上面提到的,我已经指定了不同的值,但只有三个已经工作。 所以为什么这个'*'不起作用。
这是我的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']); };
在Ubuntu 12.04 64位工作
NodeJs 0.10.17
npm 1.3.8
GruntJs 0.4.1
grunt-contrib-connect 0.3.0
这是因为咕噜试图绑定到该地址作为服务器 。 无法将服务器绑定到任意IP地址或域名。
- 0.0.0.0表示监听绑定到该主机的所有IP地址
- 127.0.0.1/localhost表示绑定到本地适配器
- nnn.nnn.nnn.nnn绑定到一个特定的IP地址(它必须在本地parsing)