"Error: getaddrinfo ENOTFOUND localhost" when publishing hello world prject

After several days reading the forum and trying to figure out the correct way to publish a project, I still met this building error when publishing. Need your help please!

$ exp publish
[exp] Publishing…
[exp] Building iOS bundle
[exp] Error: getaddrinfo ENOTFOUND localhost localhost:19003
[exp] RequestError: Error: getaddrinfo ENOTFOUND localhost localhost:19003
at new RequestError (/usr/local/lib/node_modules/exp/node_modules/request-promise-core/lib/errors.js:14:15)
at Request.plumbing.callback (/usr/local/lib/node_modules/exp/node_modules/request-promise-core/lib/plumbing.js:87:29)
at Request.RP$callback [as _callback] (/usr/local/lib/node_modules/exp/node_modules/request-promise-core/lib/plumbing.js:46:31)
at self.callback (/usr/local/lib/node_modules/exp/node_modules/request/request.js:186:22)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at Request.onRequestError (/usr/local/lib/node_modules/exp/node_modules/request/request.js:878:8)
at emitOne (events.js:116:13)
at ClientRequest.emit (events.js:211:7)
at Socket.socketErrorListener (_http_client.js:387:9)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at emitErrorNT (internal/streams/destroy.js:64:8)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)

$ more .expo/packager-info.json
“expoServerPort”: 19000,
“packagerPort”: 19001,
“packagerPid”: 76392,
“expoServerNgrokUrl”: null,
“packagerNgrokUrl”: null,
“ngrokPid”: null

$ more .expo/settings.json
“hostType”: “lan”,
“lanType”: “ip”,
“dev”: false,
“strict”: false,
“minify”: true,
“urlType”: “exp”,
“urlRandomness”: “MyRandomStringThisIsUndocumented”

$ more package.json
“main”: “node_modules/expo/AppEntry.js”,
“private”: true,
“dependencies”: {
“expo”: “^25.0.0”,
“react”: “16.2.0”,
“react-native”: “https://github.com/expo/react-native/archive/sdk-25.0.0.tar.gz

$ more app.json
“expo”: {
“name”: “my-new-project”,
“description”: “This project is really great.”,
“slug”: “my-new-project”,
“privacy”: “unlisted”,
“sdkVersion”: “25.0.0”,
“platforms”: [“ios”, “android”],
“version”: “1.0.0”,
“orientation”: “portrait”,
“icon”: “./assets/icon.png”,
“splash”: {
“image”: “./assets/splash.png”,
“resizeMode”: “contain”,
“backgroundColor”: “#ffffff
“ios”: {
“supportsTablet”: true

exp 49.0.3
XDE 2.22.1

make sure your hosts file is properly configured, eg: https://stackoverflow.com/a/41576566/659988

1 Like

@notbrent Thank you! Publishing is a success after adding this line in /etc/hosts.

$ more /etc/hosts localhost


This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.