Menu icon Foundation
Can't watch because of "ENOTFOUND localhost"

I ran foundation-apps new, then foundation-apps watch and got this error:

events.js:85
throw er; // Unhandled 'error' event
^
Error: getaddrinfo ENOTFOUND localhost
at errnoException (dns.js:44:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:94:26)
Error: foundation-apps-template@1.1.0 start: `gulp`
Exit status 1
at EventEmitter. (/usr/local/lib/node_modules/foundation-cli/node_modules/npm/lib/utils/lifecycle.js:213:16)
at EventEmitter.emit (events.js:110:17)
at ChildProcess. (/usr/local/lib/node_modules/foundation-cli/node_modules/npm/lib/utils/spawn.js:24:14)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

I am using the latest version of foundation-apps and gulp/ npm. What seems to be the problem and how do I fix it?

cli

I ran foundation-apps new, then foundation-apps watch and got this error:

events.js:85
throw er; // Unhandled 'error' event
^
Error: getaddrinfo ENOTFOUND localhost
at errnoException (dns.js:44:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:94:26)
Error: foundation-apps-template@1.1.0 start: `gulp`
Exit status 1
at EventEmitter. (/usr/local/lib/node_modules/foundation-cli/node_modules/npm/lib/utils/lifecycle.js:213:16)
at EventEmitter.emit (events.js:110:17)
at ChildProcess. (/usr/local/lib/node_modules/foundation-cli/node_modules/npm/lib/utils/spawn.js:24:14)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

I am using the latest version of foundation-apps and gulp/ npm. What seems to be the problem and how do I fix it?

Ryano Taylor almost 4 years ago

This sounds like the gulp task spinning up your server can't resolve localhost to your IP on your computron.

In your gulpfile.js just have a look for this task and try and use your local loopback instead of localhost. Also, 8080 is a super common port, you may need to swap that baby out too.

 // Starts a test server, which you can view at http://127.0.0.1:8080
gulp.task('server', ['build'], function() {
  gulp.src('./build')
    .pipe($.webserver({
      port: 8080,
      host: '127.0.0.1',
      fallback: 'index.html',
      livereload: true,
      open: true
    }))
  ;
});

I hope this helps you!

Rafi Benkual almost 4 years ago

I think you got it Ryano!