question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

After create-react-app, `npm start` not work

See original GitHub issue

Describe the bug

I follow the process on (https://reactjs.org/docs/create-a-new-react-app.html) to Create React App, npx create-react-app my-app cd my-app npm start But npm start can not work and the essor message as below,

> my-app@0.1.0 start /Users/cortey/Documents/GitHub/WebProject-React/my-app
> react-scripts start

Attempting to bind to HOST environment variable: x86_64-apple-darwin13.4.0
If this was unintentional, check that you haven't mistakenly set it in your shell.
Learn more here: https://bit.ly/CRA-advanced-config

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

Error: getaddrinfo ENOTFOUND x86_64-apple-darwin13.4.0
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:56:26)
Emitted 'error' event at:
    at GetAddrInfoReqWrap.doListen [as callback] (net.js:1457:12)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:56:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-app@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the my-app@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!     /Users/cortey/.npm/_logs/2020-07-17T04_51_32_683Z-debug.log

The complete log of this run is here,

0 info it worked if it ends with ok
1 verbose cli [ '/Users/cortey/.nvm/versions/node/v10.16.0/bin/node',
1 verbose cli   '/Users/cortey/.nvm/versions/node/v10.16.0/bin/npm',
1 verbose cli   'start' ]
2 info using npm@6.14.6
3 info using node@v10.16.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle my-app@0.1.0~prestart: my-app@0.1.0
6 info lifecycle my-app@0.1.0~start: my-app@0.1.0
7 verbose lifecycle my-app@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle my-app@0.1.0~start: PATH: /Users/cortey/.nvm/versions/node/v10.16.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/cortey/Documents/GitHub/WebProject-React/my-app/node_modules/.bin:/Users/cortey/.nvm/versions/node/v10.16.0/bin:/anaconda3/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/mysql/bin:/usr/local/mysql/support-files:/Applications/Postgres.app/Contents/Versions/11/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/cortey/.nvm/versions/node/v10.16.0/bin:/Users/cortey/opt/anaconda3/bin:/Users/cortey/opt/anaconda3/condabin:/anaconda3/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin
9 verbose lifecycle my-app@0.1.0~start: CWD: /Users/cortey/Documents/GitHub/WebProject-React/my-app
10 silly lifecycle my-app@0.1.0~start: Args: [ '-c', 'react-scripts start' ]
11 silly lifecycle my-app@0.1.0~start: Returned: code: 1  signal: null
12 info lifecycle my-app@0.1.0~start: Failed to exec start script
13 verbose stack Error: my-app@0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/Users/cortey/.nvm/versions/node/v10.16.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:198:13)
13 verbose stack     at ChildProcess.<anonymous> (/Users/cortey/.nvm/versions/node/v10.16.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:198:13)
13 verbose stack     at maybeClose (internal/child_process.js:982:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid my-app@0.1.0
15 verbose cwd /Users/cortey/Documents/GitHub/WebProject-React/my-app
16 verbose Darwin 19.3.0
17 verbose argv "/Users/cortey/.nvm/versions/node/v10.16.0/bin/node" "/Users/cortey/.nvm/versions/node/v10.16.0/bin/npm" "start"
18 verbose node v10.16.0
19 verbose npm  v6.14.6
20 error code ELIFECYCLE
21 error errno 1
22 error my-app@0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the my-app@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 ]

Actually, I npx create-react-app my-app one month ago, and it works! But today, I can create a new one but cannot run it. Plus, I changed my hosts yesterday, just add a domain, so it seems not the hosts problem.

My etc/hosts file

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1	localhost
255.255.255.255	broadcasthost
::1             localhost
127.0.0.1 api.promernstack.com ui.promernstack.com

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:23 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
sanjeetCodercommented, Dec 6, 2020

This problem is only present with react-scripts@3.0.0, downgrading to react-scripts@2.1.8 resolved the issue. TRY THIS

create-react-app my-app
cd my-app
npm install react-scripts@2.1.8
npm start

No need to downgrade react-script

Add .env file inside project folder (outside src folder) and add a line mentioned below:- SKIP_PREFLIGHT_CHECK=true then npm start

4reactions
rutikwankhadecommented, Sep 8, 2020

This problem is only present with react-scripts@3.0.0, downgrading to react-scripts@2.1.8 resolved the issue. TRY THIS

create-react-app my-app
cd my-app
npm install react-scripts@2.1.8
npm start
Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - npm start error with create-react-app - Stack Overflow
Go to your C:\Users\<USER>\AppData\Roaming · Delete npm and npm-cache directories... · Go back to your application directory and remove ...
Read more >
React npm start not working? - The freeCodeCamp Forum
Yeah my folder was named React_Practice and by using : npx create-react-app “FOLDERNAME” (newly created folder) , I had created a new folder ......
Read more >
How to fix npm start command not working - Nathan Sebhastian
How to fix npm start command not working · Check if you have a package.json file in your project · Check if you...
Read more >
"The NPM script 'start' exited without indicating that the create ...
From the error message, it seems that the react-scripts.js module was not found, try to check the package.json file whether it contains the ......
Read more >
Getting Started - Create React App
If you've previously installed create-react-app globally via npm install -g create-react-app , we recommend you uninstall the package using ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found