gpt4 book ai didi

javascript - 与新 React 应用程序运行相关的问题

转载 作者:行者123 更新时间:2023-12-02 23:12:25 25 4
gpt4 key购买 nike

我安装了 Nodejs(v 10.16.0 LTS),然后使用 Windows Powershell 运行以下命令

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

我面临的实际问题是,如果 PowerShell 窗口在后台打开,那么我的代码可以正常工作。但是当我关闭 PowerShell 并重新加载浏览器选项卡时,会出现错误

This site can’t be reached

localhost refused to connect.

Try:

Checking the connection

Checking the proxy and the firewall.

请帮我解决这个问题。谢谢

最佳答案

当您关闭 PowerShell 窗口时,您也会终止您的 React 应用程序,它必须保持打开状态。运行 npm start 会启动本地服务器并运行您的应用程序。如果您希望能够在终端关闭的情况下运行应用程序,您可以使用类似 https://www.npmjs.com/package/forever 的库,但我不建议这样做——很容易忘记您已经运行了一个应用程序实例:)

关于javascript - 与新 React 应用程序运行相关的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57287748/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com