Skip to content Skip to sidebar Skip to footer

Socket.io.js Not Found (node.js + Express + Socket.io)

I've been checking other related answers such as: node.js /socket.io/socket.io.js not found Socket.io not being served by Node.js server socket.io.js not found on client Configuri

Solution 1:

Instead of doing npm install socket.io you have to do npm install socket.io --save so the socket.io module gets installed in your web development folder (run this command at the base location/where your index.html or index.php is). This installs socket.io to the area in which the command is run, not globally, and, in addition, it automatically corrects/updates your package.json file so node.js knows that it is there.

Then change your source path from '/socket.io/socket.io.js' to 'http://' + location.hostname + ':3000/socket.io/socket.io.js'.

Post a Comment for "Socket.io.js Not Found (node.js + Express + Socket.io)"