PS E:\idea_project\sea\booklist> npx react-native start
(node:9432) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
error listen EADDRINUSE: address already in use :::8081.
Error: listen EADDRINUSE: address already in use :::8081
at Server.setupListenHandle [as _listen2] (node:net:1872:16)
at listenInCluster (node:net:1920:12)
at Server.listen (node:net:2008:7)
at E:\idea_project\sea\booklist\node_modules\@react-native-community\cli-plugin-metro\node_modules\metro\src\index.flow.js:361:14
at new Promise (<anonymous>)
at earlyPortCheck (E:\idea_project\sea\booklist\node_modules\@react-native-community\cli-plugin-metro\node_modules\metro\src\index.flow.js:357:11)
at exports.runServer (E:\idea_project\sea\booklist\node_modules\@react-native-community\cli-plugin-metro\node_modules\metro\src\index.flow.js:142:9)
at Object.runServer [as func] (E:\idea_project\sea\booklist\node_modules\@react-native-community\cli-plugin-metro\build\commands\start\runServer.js:100:49)
at async Command.handleAction (E:\idea_project\sea\booklist\node_modules\@react-native-community\cli\build\index.js:111:9)
info Run CLI with --verbose flag for more details.
打开 Windows 的命令提示符(cmd.exe)。
在命令提示符中输入以下命令:
复制
netstat -ano | findstr :8081
这将列出所有正在使用端口 8081 的进程及其 PID。
找到占用端口 8081 的进程 ID(PID),然后在任务管理器中结束该进程。