简体   繁体   中英

npm start does nothing / localhost:3000 connection refused

I have tried running a few different tutorials here and I'm getting the same result. npm start does nothing. no errors, nothing. try opening localhost:3000 and the connection is refused.

It works just fine if I change to a different user on the same computer. Any ideas how I can reset this without loosing all my other settings for every app and password.

I tried this with a fresh install of React and the basic tic tac toe on the React website as well as a few others.

Im working in vscode but I also tried it direct from the terminal. set default browser to chrome. tried following this tutorial https://reactjs.org/tutorial/tutorial.html . pretty simple stuff. just doesn't seem to work

Node -v v14.10.1 npm -v 6.14.8

ran this code in the terminal:

npx create-react-app my-app
cd my-app
npm start

And this is the result:

peterfaretra@Peters-MacBook-Pro React % npx create-react-app my-app
npx: installed 98 in 10.58s

Creating a new React app in /Users/peterfaretra/Sites/React/my-app.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...

+ react-scripts@3.4.3
+ react-dom@16.13.1
+ cra-template@1.0.3
+ react@16.13.1
added 1605 packages from 755 contributors and audited 1605 packages in 173.919s

69 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities


Initialized a git repository.

Installing template dependencies using npm...
npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.

+ @testing-library/jest-dom@4.2.4
+ @testing-library/user-event@7.2.1
+ @testing-library/react@9.5.0
added 36 packages from 57 contributors and audited 1641 packages in 12.107s

69 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Removing template package using npm...

npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.

removed 1 package and audited 1640 packages in 6.202s

69 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities


Created git commit.

Success! Created my-app at /Users/peterfaretra/Sites/React/my-app
Inside that directory, you can run several commands:

  npm start
    Starts the development server.

  npm run build
    Bundles the app into static files for production.

  npm test
    Starts the test runner.

  npm run eject
    Removes this tool and copies build dependencies, configuration files
    and scripts into the app directory. If you do this, you can’t go back!

We suggest that you begin by typing:

  cd my-app
  npm start

Happy hacking!
peterfaretra@Peters-MacBook-Pro React % 
peterfaretra@Peters-MacBook-Pro React % cd my-app 
peterfaretra@Peters-MacBook-Pro my-app % npm start
peterfaretra@Peters-MacBook-Pro my-app % 

I can see from your console/terminal that the project has been created at

/Users/peterfaretra/Sites/React/my-app

But when i see the below

peterfaretra@Peters-MacBook-Pro React % 
peterfaretra@Peters-MacBook-Pro React % cd my-app 
peterfaretra@Peters-MacBook-Pro my-app % npm start
peterfaretra@Peters-MacBook-Pro my-app % 

I am not a mac user so i can't say confidently but I cannot see the /sites path anywhere in the above mentioned paths. basically if i had to run my project my directory would be /Users/peterfaretra/Sites/React/my-app and then

npm start.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM