0

I am trying to connect to redis in linux using node js as below

var redis = require('redis');

But, getting the error as below. I have redis-2.4.17 installed in linux and the path is /home/masadmin/redis-2.4.17/src Kindly help on how to connect to redis using node in linux.

module.js:340
    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)

2 Answers 2

3

Have you installed the Node.js Redis module for your application? npm install redis (in the same directory as your application) will install it. Check out this screencast for more information.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, Brandon. Regret my mistake
0

I have the same error after Node.js Redis module has been installed. I've fixed it (error) after changing NODE_PATH environment variable:

export NODE_PATH=$NODE_PATH:<YOUR_NODE.JS_HOME>/node_modules

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.