我有一个使用以下命令从本地服务器启动的 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