facebook / create-react-app

Set up a modern web app by running one command.
https://create-react-app.dev
MIT License
102.85k stars 26.89k forks source link

Localhost Refused to Connect #10436

Open xixi743 opened 3 years ago

xixi743 commented 3 years ago

Describe the bug

Localhost refuses to connect after creating a fresh react application and running npm start. I first used npx create-react-app appname.

Did you try recovering your dependencies?

Yes, no effect.

npm --version 6.14.11

Which terms did you search for in User Guide?

Followed instructions from https://create-react-app.dev/docs/getting-started/. This didn't help https://stackoverflow.com/questions/39959900/npm-start-error-with-create-react-app Searched "failed at start react app".

Environment

  current version of create-react-app: 4.0.1
  running from /Users/alexis/.nvm/versions/node/v14.15.4/lib/node_modules/create-react-app

  System:
    OS: macOS 11.1
    CPU: (8) arm64 Apple M1
  Binaries:
    Node: 14.15.4 - ~/.nvm/versions/node/v14.15.4/bin/node
    Yarn: Not Found
    npm: 6.14.11 - ~/.nvm/versions/node/v14.15.4/bin/npm
  Browsers:
    Chrome: 88.0.4324.96
    Edge: Not Found
    Firefox: Not Found
    Safari: 14.0.2
  npmPackages:
    react: ^17.0.1 => 17.0.1 
    react-dom: ^17.0.1 => 17.0.1 
    react-scripts: 4.0.1 => 4.0.1 
  npmGlobalPackages:
    create-react-app: 4.0.1

Steps to reproduce

(Write your steps here:)

  1. run npx create-react-app portfolio
  2. cd portfolio
  3. npm start

Expected behavior

I expected to see the starting template for a react application.

Actual behavior

Chrome opened to local host with could not connect to localhost.

Debug Log:

1 verbose cli [
1 verbose cli   '/Users/alexis/.nvm/versions/node/v14.15.4/bin/node',
1 verbose cli   '/Users/alexis/.nvm/versions/node/v14.15.4/bin/npm',
1 verbose cli   'start'
1 verbose cli ]
2 info using npm@6.14.11
3 info using node@v14.15.4
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle portfolio@0.1.0~prestart: portfolio@0.1.0
6 info lifecycle portfolio@0.1.0~start: portfolio@0.1.0
7 verbose lifecycle portfolio@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle portfolio@0.1.0~start: PATH: /Users/alexis/.nvm/versions/node/v14.15.4/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/alexis/projects/portfolio/node_modules/.bin:/Users/alexis/.nvm/versions/node/v14.15.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/alexis/.nvm/versions/node/v14.15.4/bin:/opt/homebrew/bin:/Users/alexis/Library/Python/3.8/bin:/opt/homebrew/bin:/Users/alexis/Library/Python/3.8/bin
9 verbose lifecycle portfolio@0.1.0~start: CWD: /Users/alexis/projects/portfolio
10 silly lifecycle portfolio@0.1.0~start: Args: [ '-c', 'react-scripts start' ]
11 silly lifecycle portfolio@0.1.0~start: Returned: code: 1  signal: null
12 info lifecycle portfolio@0.1.0~start: Failed to exec start script
13 verbose stack Error: portfolio@0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/Users/alexis/.nvm/versions/node/v14.15.4/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (/Users/alexis/.nvm/versions/node/v14.15.4/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1048:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid portfolio@0.1.0
15 verbose cwd /Users/alexis/projects/portfolio
16 verbose Darwin 20.2.0
17 verbose argv "/Users/alexis/.nvm/versions/node/v14.15.4/bin/node" "/Users/alexis/.nvm/versions/node/v14.15.4/bin/npm" "start"
18 verbose node v14.15.4
19 verbose npm  v6.14.11
20 error code ELIFECYCLE
21 error errno 1
22 error portfolio@0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the portfolio@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 ]

I'm using a new Macbook Air running macOS Big Sur version 11.1.

mariedasig commented 3 years ago

did you see "Happy Hacking" at the end of npx create-react-app portfolio?