启动RN服务端口被占用

npx react-native start --port 8081 --host 127.0.0.1启动RN的Metro服务,报错:

bash 复制代码
D:\projects\odn\RN\LightODN>npx react-native start --port 8081 --host 127.0.0.1
warn Package react-native-sqlite-storage contains invalid configuration: "dependency.platforms.ios.project" is not allowed. Please verify it's properly linked using "react-native config" command and contact the package maintainers about this.
warn Package react-native-amap3d contains invalid configuration: "dependency.platforms.ios.project" is not allowed. Please verify it's properly linked using "react-native config" command and contact the package maintainers about this.
error listen EADDRINUSE: address already in use 127.0.0.1:8081.
Error: listen EADDRINUSE: address already in use 127.0.0.1:8081
    at Server.setupListenHandle [as _listen2] (net.js:1331:16)
    at listenInCluster (net.js:1379:12)
    at doListen (net.js:1516:7)
    at processTicksAndRejections (internal/process/task_queues.js:83:21)
info Run CLI with --verbose flag for more details.

8081端口被占,查找进程id

bash 复制代码
D:\projects\odn\RN\LightODN>netstat -aon | findstr :8081
  TCP    127.0.0.1:8081         0.0.0.0:0              LISTENING       18312
  TCP    127.0.0.1:8081         127.0.0.1:60981        ESTABLISHED     18312
  TCP    127.0.0.1:8081         127.0.0.1:60982        ESTABLISHED     18312
  TCP    127.0.0.1:60981        127.0.0.1:8081         ESTABLISHED     5348
  TCP    127.0.0.1:60982        127.0.0.1:8081         ESTABLISHED     5348

执行 taskkill /PID 18312 /F

bash 复制代码
taskkill /PID 18312 /F

然后再执行启动RN的Metro服务命令就可以了,ok.

相关推荐
赏金术士1 天前
Kotlin 数据流与单双向绑定
android·开发语言·kotlin
小白学鸿蒙1 天前
Unity 3D 2023解压安装,配置安卓运行环境后打包安卓应用(踩坑无数之差点放弃)
android·unity·游戏引擎
阿巴斯甜1 天前
2026小知识点(9)
android
古月-一个C++方向的小白1 天前
MySQL数据库——数据类型
android·数据库·mysql
张小潇1 天前
AOSP15 WMS/AMS系统开发 - WindowManagerService finishDraw与prepareSurface流程详解
android
帅次1 天前
Modifier 链与顺序、测量与命中区域
android·kotlin·compose·modifier
leory1 天前
请详细描述Handler消息机制的工作原理
android·面试
leory1 天前
请描述Binder IPC的基本原理和工作流程
android·面试
leory1 天前
View的事件分发机制是怎样的?dispatchTouchEvent、onInterceptTouchEvent、onTouchEvent的关系?
android·面试
zander2581 天前
Canal本地部署保姆级教程
android