Node server, Socket.io 'io is not defined'?

前端 未结 6 1578
伪装坚强ぢ
伪装坚强ぢ 2020-12-30 06:25

I\'ve followed the exact same steps which have always previously worked for me, create application through express, place the module dependencies in the node_modules folder.

6条回答
  •  无人及你
    2020-12-30 07:14

    I solved this by running the index page by the Node.js server.

    Most likely "index.html" and "/socket.io/socket.io.js" files should be served by your Node.js server.

    as mentioned in the url Uncaught ReferenceError: io is not defined

    So when I executed https://localhost:3000 (3000 the port where the nodejs has been started) the error got resolved.

提交回复
热议问题