reactnative之npm ERR! code ELIFECYCLE

袁轶
2023-12-01

Error: listen EADDRINUSE: address already in use :::8081

    at Server.setupListenHandle [as _listen2] (net.js:1226:14)

    at listenInCluster (net.js:1274:12)

    at Server.listen (net.js:1362:7)

    at /Users/liuzhao/Documents/Project/xsy-breeze-m-dayone/node_modules/metro/src/index.js:193:18

    at new Promise (<anonymous>)

    at Object.<anonymous> (/Users/liuzhao/Documents/Project/xsy-breeze-m-dayone/node_modules/metro/src/index.js:192:12)

    at Generator.next (<anonymous>)

    at step (/Users/liuzhao/Documents/Project/xsy-breeze-m-dayone/node_modules/metro/src/index.js:50:30)

    at /Users/liuzhao/Documents/Project/xsy-breeze-m-dayone/node_modules/metro/src/index.js:61:15

Emitted 'error' event at:

    at Server.WebSocketServer._onServerError (/Users/liuzhao/Documents/Project/xsy-breeze-m-dayone/node_modules/ws/lib/WebSocketServer.js:82:50)

    at Server.emit (events.js:205:15)

    at emitErrorNT (net.js:1253:8)

    at processTicksAndRejections (internal/process/task_queues.js:84:9) {

  code: 'EADDRINUSE',

  errno: 'EADDRINUSE',

  syscall: 'listen',

  address: '::',

  port: 8081

}

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! rkhd@1810.9.0 start: `node node_modules/react-native/local-cli/cli.js start`

npm ERR! Exit status 1

npm ERR! 

npm ERR! Failed at the rkhd@1810.9.0 start script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

 

npm ERR! A complete log of this run can be found in:

npm ERR!     /Users/liuzhao/.npm/_logs/2019-07-29T11_14_35_049Z-debug.log

 

 

从内容上来看是端口号8081被占用。

我是开了两次,将之前的那个停掉就行了,如果不想停掉,就更改端口号

 类似资料: