启动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.

相关推荐
玩机达人881 小时前
一加12/Ace5/Ace3pro手机ColorOS16降级回锁BL熔断变黑砖怎么办
android·智能手机·电脑
Digitally2 小时前
使用 USB 数据线将文件从安卓设备传输到电脑
android·电脑
xieliyu.3 小时前
MySQL 六大基础约束详解:NOT NULL/DEFAULT/UNIQUE/ 主键 / 外键 / CHECK
android·数据库·sql·mysql
Anokata3 小时前
MYSQL SQL 执行系列1
android·sql·mysql
REDcker4 小时前
Android 15 16KB 内存页适配详解
android·开发语言·python
Kapaseker4 小时前
Android 开放这扇门,正在被 Google 从里面反锁
android·kotlin
帅次4 小时前
Android 高级工程师面试:网络与数据层 近1年高频追问 18 题
android·网络·okhttp·面试·retrofit·gilde
三少爷的鞋5 小时前
Android 架构这些年,其实一直在消灭碎片化异步
android
牛仔只喝牛奶20 小时前
多端跨端技术选型:小程序 + H5 + App 的两栈拆分落地
react native·react.js
plainGeekDev21 小时前
依赖管理 → Version Catalog
android·java·kotlin