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

相关推荐
Code-keys4 小时前
Android Codec2 Filter 算法模块开发指南
android·算法·音视频·视频编解码
y = xⁿ5 小时前
MySQL:count(1)与count(*)有什么区别,深分页问题
android·数据库·mysql
程序员陆业聪7 小时前
Android启动全景图:一次冷启动背后到底发生了什么
android
安卓程序员_谢伟光9 小时前
m3颜色定义
android·compose
麻辣璐璐10 小时前
EditText属性运用之适配RTL语言和LTR语言的输入习惯
android·xml·java·开发语言·安卓
北京自在科技10 小时前
谷歌 Find Hub 网页端全面升级:电脑可直接管理追踪器与耳机
android·ios·安卓·findmy
Rush-Rabbit10 小时前
魅族21Pro刷ColorOS16.0操作步骤
android
爪洼传承人10 小时前
AI工具MCP的配置,慢sql优化
android·数据库·sql
学习使我健康10 小时前
MVP模式
android·github·软件工程