Skip to content Skip to sidebar Skip to footer

Node: Socket Io Require.resolve Is Not A Function?

I'm surprised that googling this does not give me any results. Anyway here's my problem when using socket.io: When I check further, it was from socket.io index.js source file (lin

Solution 1:

browserify implementation of require doesn't have resolve method.

for obvious reasons, you can't run socket.io server inside browser. If you really want a socket.io client, you should require socket.io-client (readme says it is browserify-compatible).

Solution 2:

To use socket.io in the browser install the client lib:

npm install socket.io-client --save

it can be imported with:

var io = require('socket.io-client');

Post a Comment for "Node: Socket Io Require.resolve Is Not A Function?"