0

I'm currently learning Express and react right now and was able to run react app originally. While starting a new web app(Yesterday), I was not able to prevent a freshly created react app from crashing.

My OS:
openSUSE 20180522 <br>
Kernel: x86_64 Linux 4.16.9-1-default

The error:

$ npm start

 > movieapp@0.1.0 start 
 /home/knosence/Templates/syntelBootCamp/react/movieapp
 > react-scripts start

 Attempting to bind to HOST environment variable: linux-gz59
 If this was unintentional, check that you haven't mistakenly set it 
 in your shell.
 Learn more here: https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#advanced-configuration

 events.js:183
    throw er; // Unhandled 'error' event
    ^

 Error: getaddrinfo ENOTFOUND linux-gz59
     at errnoException (dns.js:50:10)
     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
 npm ERR! code ELIFECYCLE
 npm ERR! errno 1
 npm ERR! movieapp@0.1.0 start: `react-scripts start`
 npm ERR! Exit status 1
 npm ERR! 
 npm ERR! Failed at the movieapp@0.1.0 start script.
 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

 npm ERR! A complete log of this run can be found in:
 npm ERR!     /home/knosence/.npm/_logs/2018-05-24T20_48_01_951Z- 
 debug.log

`

$ cat /home/knosence/.npm/_logs/2018-05-24T20_48_01_951Z-debug.log<br> 
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node8', '/usr/local/bin/npm', 'start' ]
2 info using npm@6.0.1
3 info using node@v8.11.2
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle movieapp@0.1.0~prestart: movieapp@0.1.0
6 info lifecycle movieapp@0.1.0~start: movieapp@0.1.0
7 verbose lifecycle movieapp@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle movieapp@0.1.0~start: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/knosence/Templates/syntelBootCamp/react/movieapp/node_modules/.bin:/home/knosence/bin:/usr/local/bin:/usr/bin:/bin:/usr/lib/mit/sbin:/snap/bin
9 verbose lifecycle movieapp@0.1.0~start: CWD: /home/knosence/Templates/syntelBootCamp/react/movieapp
10 silly lifecycle movieapp@0.1.0~start: Args: [ '-c', 'react-scripts start' ]
11 silly lifecycle movieapp@0.1.0~start: Returned: code: 1  signal: null
12 info lifecycle movieapp@0.1.0~start: Failed to exec start script
13 verbose stack Error: movieapp@0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:283:16)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at EventEmitter.emit (events.js:214:7)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at ChildProcess.emit (events.js:214:7)
13 verbose stack     at maybeClose (internal/child_process.js:925:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid movieapp@0.1.0
15 verbose cwd /home/knosence/Templates/syntelBootCamp/react/movieapp
16 verbose Linux 4.16.9-1-default
17 verbose argv "/usr/bin/node8" "/usr/local/bin/npm" "start"
18 verbose node v8.11.2
19 verbose npm  v6.0.1
20 error code ELIFECYCLE
21 error errno 1
22 error movieapp@0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the movieapp@0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

`

If anyone can help me with this then it will be greatly appreciated!! If anyone needs more information, let me know and I will provide. Thanks!

  • 1
    It may be a [hosts file problem](https://stackoverflow.com/questions/23259697/error-getaddrinfo-enotfound-in-nodejs-for-get-call) – HMR May 25 '18 at 14:00
  • I provided an answer in the following post https://stackoverflow.com/a/63566465/4501494 – Esmaeil MIRZAEE Aug 24 '20 at 18:14

2 Answers2

0

Your machine probably has a global HOST environment variable so Create React App tries to find an open port on it instead of the default localhost. Delete the environment variable and it should work fine as you want.

Maybe this answer will help you.

Create-react-app error

Hitesh Chaudhari
  • 705
  • 1
  • 7
  • 12
0

I faced the same issue and fixed it using

HOST=localhost npm start

Hope that it helps anyone else!