FinDev
FinDev

Reputation: 4827

Cannot find module 'socket.io/node_modules/redis'

When trying to do

var redis = require('socket.io/node_modules/redis');

I get the error "Cannot find module 'socket.io/node_modules/redis" and I can't figure out why. I am running windows and ran "npm install socket.io"

It seems like the same issue here: Error: Cannot find module 'socket.io/node_modules/redis' but the redis server is up and running.

In my "socket.io/node_modules" folder I don't see anything Redis related.

Upvotes: 3

Views: 7190

Answers (3)

Sukhpreet Singh
Sukhpreet Singh

Reputation: 641

Rather run

npm install socket.io-redis --save

This will install this npm package. I used this and it worked.

Upvotes: 0

Oleg
Oleg

Reputation: 23297

It seems that you're using Socket.IO 1.0. Since 1.0 there is no more redis dependency. You can follow @go-oleg's recommendation and install redis package on your own.

Upvotes: 2

go-oleg
go-oleg

Reputation: 19480

The socket.io package.json doesn't show a dependency on redis:

  "dependencies": {
    "engine.io": "Automattic/engine.io#15afd3",
    "socket.io-parser": "2.2.1",
    "socket.io-client": "Automattic/socket.io-client#05c9632",
    "socket.io-adapter": "0.2.0",
    "has-binary-data": "0.1.3",
    "debug": "0.7.4"
  }

Either way, theres no need to directly depend on another library's dependencies. If you need to use redis in your code, you can install redis and add it to your package.json using:

npm install redis --save

and require like:

var redis = require('redis');

Upvotes: 5

Related Questions