简体   繁体   English

运行'npm start'时从外部访问React App

[英]Accessing React App externally, when running 'npm start'

I'm using create-react app . 我正在使用create-react app In order to view the project in the browser locally: 为了在浏览器中本地查看项目:

  1. In the command line, in the application directory I type the command npm start 在命令行的应用程序目录中,键入命令npm start
  2. In the browser I type http://localhost:3000/ for the URL on the same computer (Or other port I specify). 在浏览器中,我输入http://localhost:3000/作为同一台计算机上的URL(或我指定的其他端口)。

I'd like to be able to access the project from browsers on other computers as well. 我也希望能够从其他计算机上的浏览器访问该项目。 This is for the purpose of QA. 这是为了进行质量检查。 How can I set it? 我该如何设置? Is there a way to set it in the package.json file, and without npm eject ? 有没有一种方法可以在package.json文件中进行设置,而无需使用npm eject

You can establish Public Connection using ngrok . 您可以使用ngrok建立公共连接。 When you run ngrok you instantly get a public address to your local development machine. 运行ngrok时,您会立即获得本地开发计算机的公共地址。 You share generated public Ngrok link (viz. http://92832de0.ngrok.io ) with other users. 您与其他用户共享生成的公共Ngrok链接(即http://92832de0.ngrok.io )。 They connect to Ngrok and this connection between their pc and Ngrok is referred to as Public Connection 他们连接到Ngrok,并且他们的PC和Ngrok之间的这种连接称为“公共连接”

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

相关问题 npm 使用 create-react-app 时启动不运行 - npm start not running when using create-react-app 在React应用中运行'npm start'时出现不必要的转义字符警告 - Unnecessary escape character warning when running 'npm start' with React app 使用 create-react-app (npm start) 运行项目时如何在 Chrome 上启用地理定位? - How to enable geolocation on Chrome when running a project with create-react-app (npm start)? 为什么在使用 npm 启动时运行反应应用程序时出现此错误? - Why am i getting this error when running react app while using npm start? npx create-react-app 在运行 npm 启动时出错 - npx create-react-app gives error when running npm start 在 React 应用程序中运行 npm start 时出现 babel-jest 依赖问题 - Issue with babel-jest dependency when running npm start in a React app React.js - 从 npm 开始运行时应用程序工作,但不会构建 - React.js - app works when running from npm start, but won't build 在反应应用程序中运行 npm 启动后,我的浏览器上没有显示任何内容 - Nothing is Displaying on my browser after running npm start in react app 运行npm start命令时React Redux项目的语法错误 - Syntax Error for React Redux Project when running npm start command 语法错误:运行 npm start 时 React 中出现意外令牌 - Syntax error: Unexpected Token in React when running npm start
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM