“react-native run-ios"时端口 8081 已在使用中 [英] port 8081 already in use when "react-native run-ios"
问题描述
是的,我已经阅读了这篇文章,但仍然不知道如何让它发挥作用.反应原生- 端口 8081 已在使用,打包程序未运行或未正确运行命令/bin/sh 失败,退出代码 2
Yes i have read this but still don't know how to make it work. react native - Port 8081 already in use, packager is either not running or not running correctly Command /bin/sh failed with exit code 2
原来我是这样做的
1. react-native init Hello
2. react-native run-ios
然后点击这个端口 8081 已经在使用中".
Then hit this "port 8081 already in use".
阅读了 React 文档,https://facebook.github.io/react-native/docs/troubleshooting.html
Did read the react doc, https://facebook.github.io/react-native/docs/troubleshooting.html
1. cannot kill the process using 8081, it keeps on coming back,
and i don't want to kill it
2. react-native start --port=8088
3. update node_modules/react-
native/React/React.xcodeproj/project.pbxproj file. Did it.
我应该在哪里运行react-native start --port=8088"?
Where and which step should i run "react-native start --port=8088" ?
顺便说一句,我是一个普通的工程师,但如果我不能在 2 小时内运行第一个 react-native 样本,我就是看不到它是如何飞行的,这很烦人.
btw, i'm an average engineer, but if i cannot run the very 1st react-native sample in 2 hours, i just cannot see how it can fly, this is very annoying.
推荐答案
在 RN 0.55 中,您可以通过以下方式解决此问题:
In RN 0.55 you can fix this with:
react-native start --port=1234
然后在另一个窗口:
react-native run-ios --port 1234
版本:
✗ react-native --version
react-native-cli: 2.0.1
react-native: 0.55.4
这篇关于“react-native run-ios"时端口 8081 已在使用中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!