我无法运行任何 react-native 项目。 它说已经有一个进程在运行。端口 8081 被在我的 MAC 上运行的迈克菲防病毒软件占用。而且我无论如何也杀不死它(虽然我不应该杀它,但我试过了,看起来它永远不会死!毕竟 SUDO 没有力量!)
引用#7308 #9145和 stackoverflow ,我尝试在端口 8082 上运行。服务器启动,但是,run-android 仍然失败,提示未找到设备。 我同时打开了我的设备(打开 Debug模式的 Galaxy S7 Edge)和 Genymotion。
React Native 版本详情 -
SATJAGAN-M-T0HZ:react-native-card-modal satjagan$ react-native -v
react-native-cli: 1.0.0
react-native: 0.37.0
Genymotion 活跃且可用 -
bozzmob:Twitter bozzmobusr$ adb devices
List of devices attached
192.168.57.101:5555 device
运行应用程序的终端日志- (有趣的是它说JS Server not recognized,那里有什么问题吗)?
bozzmob:Twitter bozzmobusr$ react-native start --port 8082
Scanning 712 folders for symlinks in /Users/satjagan/collection/work/github/reactnative/react-native-card-modal/node_modules (15ms)
┌────────────────────────────────────────────────────────────────────────────┐
│ Running packager on port 8082. │
│ │
│ Keep this packager running while developing on any JS projects. Feel │
│ free to close this tab and run your own packager instance if you │
│ prefer. │
│ │
│ https://github.com/facebook/react-native │
│ │
└────────────────────────────────────────────────────────────────────────────┘
Looking for JS files in
/Users/satjagan/collection/work/github/reactnative/react-native-card-modal
[Hot Module Replacement] Server listening on /hot
React packager ready.
[11/26/2016, 2:47:25 PM] <START> Initializing Packager
[11/26/2016, 2:47:25 PM] <START> Building in-memory fs for JavaScript
[11/26/2016, 2:47:25 PM] <END> Building in-memory fs for JavaScript (184ms)
[11/26/2016, 2:47:25 PM] <START> Building Haste Map
[11/26/2016, 2:47:25 PM] <END> Building Haste Map (425ms)
[11/26/2016, 2:47:25 PM] <END> Initializing Packager (741ms)
bozzmob:Twitter bozzmobusr$ react-native run-android
**JS server not recognized, continuing with build...**
Running adb -s 192.168.57.101:5555 reverse tcp:8081 tcp:8081
Building and installing the app on the device (cd android && ./gradlew installDebug...
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment.
Go to https://facebook.github.io/react-native/docs/getting-started.html
and check the Android tab for setup instructions.
不幸的是,卸载 McAfee 不是一个选项 :( 如果我有自由,我会先做。
最佳答案
React-Native 仍在尝试连接到 8081.
上的打包器通常你打开开发菜单并指定一个不同的端口,但在你的情况下你甚至无法开始。
您似乎无法以其他方式指定端口。我认为您可能有两种选择:
关于android - 无法在 react-native run-android 上的设备上安装应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40817009/