2
votes

I use Node.js. My server js script I run such:

node chat_server.js

After I get errors messages in terminal CentOS:

Express server listening on port undefined in development mode.

+ User undefined connected node_redis: no callback to send error: ERR wrong number of arguments for 'sadd' command

/home/who/public_html/node/node_modules/redis/index.js:582 throw err; ^ Error: ERR wrong number of arguments for 'sadd' command at ReplyParser. (/home/who/public_html/node/node_modules/redis/index.js:317:31) at ReplyParser.emit (events.js:95:17) at ReplyParser.send_error (/home/who/public_html/node/node_modules/redis/lib/parser/javascript.js:296:10) at ReplyParser.execute (/home/who/public_html/node/node_modules/redis/lib/parser/javascript.js:181:22) at RedisClient.on_data (/home/who/public_html/node/node_modules/redis/index.js:547:27) at Socket. (/home/who/public_html/node/node_modules/redis/index.js:102:14) at Socket.emit (events.js:95:17) at Socket. (_stream_readable.js:748:14) at Socket.emit (events.js:92:17)

at emitReadable_ (_stream_readable.js:410:10)

Excuse me, but I do not understand the reason of these errors. On what I should get attention and how fix it?

For example, I use command redis SADD: redis_cli.sadd( "user.friend:" + currentIdUser, data.idUser);

I have done a experiment, created a new text script:

var redis = require("redis");
var client = redis.createClient();

client.on("error", function (err) {
    console.log("Error " + err);
});

client.sadd("users","naveen",function(err,reply){
    console.log('Ok');
        if(err)
            throw err;
        return reply;

   });

It have given me in console: OK. It mean, that all works fine. I think in my code:

redis_cli.sadd("userslist", currentIdUser);

the variable currentUser is simply empty or undefined. It gives me the next errors.

1
check your port variable...Ravi
Redis is available now, via client console: # redis_cli Port is: 6379 in /redis/index.js default_port = 6379, default_host = "127.0.0.1";Alice
redis and node version?Ravi
Here is a same problem: github.com/malditogeek/vmux/issues/20 Node Version v0.10.29, Redis Version v=2.8.12 sha=00000000:0 malloc=jemalloc-3.6.0 bits=64 build=630f2ccf4a71c8e5Alice
All versions are not old. Only can try to update Redis. But dont know how at CentOS. I installed redis via NPM: npm install redis Maybe in this problemAlice

1 Answers

0
votes

Problem was at my script in line:

redis_cli.sadd("userslist", currentIdUser);

The variable is undefined. It calls error redis. Thank you all for help.