0

我有一个使用以下命令从本地服务器启动的 React JS 应用程序react-scripts start

Compiled successfully!

You can now view telco-widget in the browser.

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

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

我想向世界公开本地主机,所以我尝试了 ngrok

ngrok http 3000

这给出了有效的输出:

Session Status                online                                                                                                        
Account                       xxx (Plan: Free)                                                                                              
Version                       2.3.35                                                                                                        
Region                        Europe (eu)                                                                                                   
Web Interface                 http://127.0.0.1:4040                                                                                         
Forwarding                    http://xxx.eu.ngrok.io -> http://localhost:3000                                                      
Forwarding                    https://xxx.eu.ngrok.io -> http://localhost:3000                                                     
                                                                                                                                            
Connections                   ttl     opn     rt1     rt5     p50     p90                                                                   
                              0       0       0.00    0.00    0.00    0.00 

但是一旦我尝试到达https://xxx.eu.ngrok.io我就会看到一个错误:

在此处输入图像描述

我也试过:

  • ngrok类似的替代方案,localtunnel但结果相似:504 错误
  • 更改网络服务器的端口
  • ngrok使用(运行良好ngrok http file:///Users/me/share:)而不是 localhost为本地目录提供服务
  • 使用干净etc/hosts

工具版本:

  • 反应脚本 - 3.1.2
  • 纱线 - 1.22.4
  • ngrok - 2.3.35
  • 本地隧道 - 2.0.0
4

1 回答 1

0

老兄!您的网络服务器没有运行。

确保您的服务器正在运行并尝试在浏览器中打开链接 localhost:3000。然后让我知道您是否还有任何问题。

于 2020-10-12T12:37:20.537 回答