Linux command
react-native-start 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Start Metro bundler
react-native start
Start on specific port
react-native start --port [8082]
Start and reset cache
react-native start --reset-cache
Start with verbose output
react-native start --verbose
Start bound to a specific host
react-native start --host [0.0.0.0]
说明
react-native start launches the Metro JavaScript bundler, a development server that compiles and serves JavaScript bundles to React Native apps running on simulators, emulators, or physical devices. It watches source files for changes and pushes updates to connected apps via hot reloading, enabling rapid development without full rebuilds. The bundler listens on port 8081 by default and can be customized with --port. The --reset-cache flag clears the bundler's transformation cache, which is useful when resolving stale module resolution issues or after changing configuration. Use --host 0.0.0.0 to make the server accessible from other devices on the network, such as physical phones on the same Wi-Fi.
参数
- --port _port_
- Server port (default 8081).
- --reset-cache
- Clear bundler cache.
- --verbose
- Verbose output.
- --host _host_
- Server hostname.
- --https
- Enable HTTPS.
- --config _path_
- Metro config file.
- --experimental-debugger
- Enable the new JS debugger (Hermes debugger).
FAQ
What is the react-native-start command used for?
react-native start launches the Metro JavaScript bundler, a development server that compiles and serves JavaScript bundles to React Native apps running on simulators, emulators, or physical devices. It watches source files for changes and pushes updates to connected apps via hot reloading, enabling rapid development without full rebuilds. The bundler listens on port 8081 by default and can be customized with --port. The --reset-cache flag clears the bundler's transformation cache, which is useful when resolving stale module resolution issues or after changing configuration. Use --host 0.0.0.0 to make the server accessible from other devices on the network, such as physical phones on the same Wi-Fi.
How do I run a basic react-native-start example?
Run `react-native start` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --port _port_ do in react-native-start?
Server port (default 8081).