node.js express socket.io port 3000 in use

后端 未结 8 439
南笙
南笙 2021-02-02 16:33

I\'ve been following this(http://socket.io/get-started/chat/) tutorial on how to make a simple chat application using socket.io.

I tried to however use Express to create

相关标签:
8条回答
  • 2021-02-02 17:21

    Try running:

    netstat -anp tcp | grep 3000
    

    This should show you the name of the process that is using port 3000. Here's another issue on StackOverflow that covers this issue in more depth.

    0 讨论(0)
  • 2021-02-02 17:29

    Similar to answer above to not use npm start.

    I was using nodemon and with expressjs and expressjs generator. I was using nodemon to execute npm start, while npm start itself execute node ./NodeApp/bin/www

    So i edited to make nodemon to execute node ./NodeApp/bin/www by itself and that error go away.

    Conclusion

    Before

    package.json

    "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1",
        "start": "node ./NodeApp/bin/www",
        "build": "webpack --watch",
        "dev": "nodemon --exec npm start"
    },
    

    After

    "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1",
        "build": "webpack --watch",
        "dev": "nodemon --exec node ./NodeApp/bin/www"
    },
    

    So now I run my sever with npm run dev and no more errors.

    0 讨论(0)
提交回复
热议问题