每日一坑:nodejs运行报错 listen EADDRNOTAVAIL: address not available

报错
events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRNOTAVAIL: address not available 127.0.0.0:2323
    at Server.setupListenHandle [as _listen2] (net.js:1253:19)
    at listenInCluster (net.js:1318:12)
    at doListen (net.js:1451:7)
    at process._tickCallback (internal/process/next_tick.js:63:19)
    at Function.Module.runMain (internal/modules/cjs/loader.js:757:11)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
Emitted 'error' event at:
    at emitErrorNT (net.js:1297:8)
    at process._tickCallback (internal/process/next_tick.js:63:19)
    [... lines matching original stack trace ...]
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

错误原因:监听端口写错成 127.0.0.0
解决方案:应该写成127.0.0.1 或者本机IP或者正确的服务器IP
扩展:如果IP没错,看看是不是端口被占用了。
之前以为是端口问题,尝试都没解决,后来认真看下代码才发现是ip写的有问题。

你可能感兴趣的:(每日一坑:nodejs运行报错 listen EADDRNOTAVAIL: address not available)