简体   繁体   English

为什么我的 React App 没有在 localhost 上加载?

[英]Why is my React App not loading on localhost?

I've been working on with React for a while, successfully using npm start to view how my application is running.我一直在使用 React 一段时间,成功地使用npm start来查看我的应用程序是如何运行的。

At some point, my app stopped loading at http://localhost:3000/ .在某个时候,我的应用程序在http://localhost:3000/处停止加载。

I get this in the terminal:我在终端得到这个:

Compiled successfully!

You can now view contact-list in the browser.

  Local:            http://localhost:3000
  On Your Network:  http://192.168.1.16:3000

Note that the development build is not optimized.
To create a production build, use npm run build.

In my Chrome browser, it looks like it's just perpetually loading, showing no errors.在我的 Chrome 浏览器中,它看起来只是在永久加载,没有显示任何错误。 Nothing is showing up in the console.控制台中没有显示任何内容。

I tried deleting the browser cache.我尝试删除浏览器缓存。

I tried checking http://192.168.1.16:3000 .我尝试检查http://192.168.1.16:3000 It also just perpetually loaded.它也只是永久加载。

I tried another project on the same port and it worked, so it doesn't seem like an issue with the port.我在同一个端口上尝试了另一个项目并且它有效,所以它似乎不是端口的问题。

Here is my package.json:这是我的 package.json:

{
  "name": "contact-list",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.11.10",
    "@testing-library/react": "^11.2.6",
    "@testing-library/user-event": "^12.8.3",
    "bootstrap": "^5.1.3",
    "react": "^18.1.0",
    "react-dom": "^17.0.2",
    "react-router-dom": "^6.3.0",
    "react-scripts": "4.0.3",
    "web-vitals": "^1.1.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

Does anyone know what could be going wrong?有谁知道可能出了什么问题?

Not enough data.没有足够的数据。 But one of the reasons could be that at some point port 3000 was not released correctly.但原因之一可能是在某些时候端口 3000 未正确释放。 Try to kill the process by port, or simply reboot the system尝试通过端口杀死进程,或者干脆重启系统

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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