Javascript – Connect Redis using node JS in Linux

Connect Redis using node JS in Linux… here is a solution to the problem.

Connect Redis using node JS in Linux

I’m trying to connect to redis in linux using Node js as shown below

var redis = require('redis');

However, you get an error similar to the following.
I installed redis-2.4.17 in linux at /home/masadmin/redis-2.4.17/src
Please help how to connect to redis using Node in linux.

    throw err;

Error: Cannot find module 'redis'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at Object.<anonymous> (/home/masadmin/Vinod/prapprRedisLoad.js:2:13)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions.. js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:492:10)


Do you have a Node.js Redis module installed for your application? npm install redis (in the same directory as your application) will install it. See this screencast for more information.

Related Problems and Solutions