Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gruntjs: Fatal error: getaddrinfo ENOTFOUND

i should probably point out that i'm inexperienced user first, and my issue is that the 'hostname' property can't have any values assigned except for an empty string(''), '0.0.0.0' and 'localhost'. I getting: Fatal error: getaddrinfo ENOTFOUND. What am i doing wrong?

If get it right, i can change the adress that i'm usually typing in the address bar, so instead 'localhost' i could have typed 'example.com' or something like that.

As i mentioned above i've assigned it different values but only three of them have worked. so why this '*' isn't working.

Here is 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']);

};

Working on Ubuntu 12.04 64bit

NodeJs 0.10.17

npm 1.3.8

GruntJs 0.4.1

grunt-contrib-connect 0.3.0

like image 671
orustammanapov Avatar asked Aug 24 '13 20:08

orustammanapov


1 Answers

It is because grunt is attempting to bind to that address as a Server. It is not possible to bind as a server to arbitrary IP addresses or domain names.

  • 0.0.0.0 means listen to on all IP addresses bound to this host
  • 127.0.0.1/localhost means bind to the local adapter
  • nnn.nnn.nnn.nnn binds to a particular IP address (it must resolve locally)
like image 52
dc5 Avatar answered Sep 25 '22 19:09

dc5