npm start 什么都不做/localhost:3000 连接被拒绝 [英] npm start does nothing / localhost:3000 connection refused

查看:309
本文介绍了npm start 什么都不做/localhost:3000 连接被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在这里运行一些不同的教程,但得到了相同的结果.npm start 什么都不做.没有错误,什么都没有.尝试打开 localhost:3000 连接被拒绝.

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.

我通过全新安装的 React 和 React 网站上的基本井字游戏以及其他一些网站进行了尝试.

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.

我在 vscode 中工作,但我也直接从终端尝试过.将默认浏览器设置为 chrome.尝试遵循本教程 https://reactjs.org/tutorial/tutorial.html.很简单的东西.只是似乎不起作用

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

节点 -v v14.10.1npm -v 6.14.8

Node -v v14.10.1 npm -v 6.14.8

在终端中运行此代码:

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

这是结果:

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 % 

我不是 mac 用户,所以我不能自信地说,但我在上述路径中的任何地方都看不到 /sites 路径.基本上,如果我必须运行我的项目,我的目录将是 /Users/peterfaretra/Sites/React/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.

这篇关于npm start 什么都不做/localhost:3000 连接被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆