Error: connect ECONNREFUSED 127.0.0.1:6379 - redis

I have coding like this
const redis = require("redis");
const client = redis.createClient();
client.on("connect", function() {
console.log("You are now connected");
});
client.set("student", "Laylaa", function(err, reply) {
console.log(reply);
});
but there is an error like this..
events.js:291
throw er; // Unhandled 'error' event
^
Error: connect ECONNREFUSED 127.0.0.1:6379
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1145:16)
Emitted 'error' event on RedisClient instance at:
at RedisClient.on_error (E:\TEKNIK INFORMATIKA\Latihan redis\node_modules\redis\index.js:341:14)
at Socket. (E:\TEKNIK INFORMATIKA\Latihan redis\node_modules\redis\index.js:222:14)
at Socket.emit (events.js:314:20)
at emitErrorNT (internal/streams/destroy.js:106:8)
at emitErrorCloseNT (internal/streams/destroy.js:74:3)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
errno: -4078,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 6379
}
is there a solution? Thanks

You need to first start the redis server by executing:
redis-server
in a terminal, after redis has been installed and before launching the Node.js client.
You could also add a script to your package.json:
"scripts": {
"redis": "redis-server"
}
and run:
npm run redis

On Linux Ubuntu you’ll need to run
sudo apt-get install redis-server
and Redis will automatically be up and running.Once it’s started, Redis listens on port 6379
.

Related

Cadence Development setup

I was trying to setup the cadence server in local though https://github.com/uber/cadence/blob/master/CONTRIBUTING.md
Tried to setup cadence-web via docker. Below are the commands executed to start the docker
docker pull ubercadence/web:latest
docker run -p 8088:8088 <image-id>
But I am getting an error while trying to fetch domain
{ TchannelSocketError: tchannel socket error (ECONNREFUSED from connect): connect ECONNREFUSED 127.0.0.1:7933
at createError (/usr/app/node_modules/error/typed.js:40:22)
at Object.createError [as SocketError] (/usr/app/node_modules/error/wrapped.js:99:19)
at TChannelConnection.onSocketError (/usr/app/node_modules/tchannel/connection.js:918:30)
at Socket.onSocketError (/usr/app/node_modules/tchannel/connection.js:479:14)
at Socket.emit (events.js:198:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
type: 'tchannel.socket',
name: 'TchannelSocketError',
message:
'tchannel socket error (ECONNREFUSED from connect): connect ECONNREFUSED 127.0.0.1:7933',
hostPort: null,
direction: 'out',
remoteAddr: null,
socketRemoteAddr: '127.0.0.1:7933',
causeMessage: 'connect ECONNREFUSED 127.0.0.1:7933',
origMessage: 'connect ECONNREFUSED 127.0.0.1:7933',
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
fullType: 'tchannel.socket~!~error.wrapped-io.connect.ECONNREFUSED' }
fetchDomainListNextPage retry: 0 error: tchannel socket error (ECONNREFUSED from connect): connect ECONNREFUSED 127.0.0.1:7933
fetchDomainListNextPage retry: 1 error: tchannel socket error (ECONNREFUSED from connect): connect ECONNREFUSED 127.0.0.1:7933
fetchDomainListNextPage retry: 2 error: tchannel socket error (ECONNREFUSED from connect): connect ECONNREFUSED 127.0.0.1:7933
Please let me know if anyone knows how to resolve this, Thanks.

How do I use Vite and Jest with IntelliJ?

I am trying to run a Jest integration test from Intellij. I right click and say run it tries to run but then I get...
/bin/sh: vite: command not found
I tried adding this to the env vars in the Intellij Run Dialog....
PATH=$PATH:/my/dir/node_modules/.bin
But then I get...
env: node: No such file or directory
node:events:371
throw er; // Unhandled 'error' event
^
Error: spawn pgrep ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn pgrep',
path: 'pgrep',
spawnargs: [ '-P', 6190 ]
}
I can confirm that vite is in /my/dir/node_modules/.bin and npx vite works from terminal. Vite is not (nor will I) installed globally
In my case I was using Puppeteer to run integration tests in the browser. Adding npm here...
module.exports = {
...
server: {
command: `npx vite --port 8080 --mode ${process.env.ENV_MODE || "development"}`,
port: 8080,
launchTimeout: 10000,
},
};
Notice was vite --port 8080 now npx vite --port 8080
This may not work with some older versions of NPM that don't include npx (don't remember version but think it is behind LTS).

Running "vue ui" on Windows Subsystem For Linux (WSL) will not work

An error will get generated when running:
vue ui
vue ui
🚀 Starting GUI...
🌠 Ready on http://localhost:8001
events.js:287
throw er; // Unhandled 'error' event
^
Error: spawn cmd.exe ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn cmd.exe',
path: 'cmd.exe',
spawnargs: [ '/c', 'start', '""', '/b', 'http://localhost:8001' ]
}
Expected to get an app running on port localhost:8001, but the above error gets generated.
The reason is because it is trying to open a browser window from inside WSL terminal.
Instead, do the following:
vue ui --headless
This will avoid running the cmd.exe to open a browser and instead run the app on port 8001. You'll have to open a browser manually to http://localhost:8001

Failed to install redis-commander in debian strech

I tried to install redis-commander but when i run redis-commander i am getting the following errors
redis-commander
{ Error: ENOENT : no such file or directory, open '/root/.redis-commander'
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/root/.redis-commander' }
No config found or was invalid.
Using default configuration.
No Save: true
listening on 0.0.0.0 : 8081
events.js:137
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE 0.0.0.0:8081
at Object._errnoException (util.js:1003:13)
at _exceptionWithHostPort (util.js:1024:20)
at Server.setupListenHandle [as _listen2] (net.js:1366:14)
at listenInCluster (net.js:1407:12)
at doListen (net.js:1522:7)
at process._tickCallback (internal/process/next_tick.js:152:19)
root#debian:/home/midhun#
Means address (port) already in use by some other process

in openshift, phantomjs crash

I try use phantomjs in openshift, but this crash.
searching the problem, I try phantom.create in the node terminal
var phantom = require('phantom');
phantom.create(function(ph){
... ph.exit();
... });
{ options:
{ prefix: '',
response_limit: 131072,
websocket: true,
jsessionid: false,
heartbeat_delay: 25000,
disconnect_delay: 5000,
log: [Function],
sockjs_url: 'https://d1fxtkz8shb9d2.cloudfront.net/sockjs-0.3.min.js' },
_events: { connection: [Function] },
install: [Function] }
>
events.js:72
throw er; // Unhandled 'error' event
^
Error: listen EACCES
at errnoException (net.js:901:11)
at Server._listen2 (net.js:1020:19)
at listen (net.js:1061:10)
at net.js:1143:9
at asyncCallback (dns.js:68:16)
at Object.onanswer [as oncomplete] (dns.js:121:9)
phantom crash, and out of openshift the lines work fine.
any suggestion ?
EDIT
I use a phantomjs downloaded from
http://phantomjs.org/download.html
https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2
The Error: listen EACCES means that phantom is trying to listen on the wrong host/port for your gear. Since it looks like you're leveraging websockets, make sure that you're using the $OPENSHIFT_NODEJS_IP environment variable as your host and 8443 or 8000 (secure vs non-secure) for your ports.