I am a newbie in node.js.I am getting a strange error in my code-
Failed to open socket on port 4243, waiting 1000 ms before retrying.
I tried using netstat -a but could not found opened port 4243.Kindly suggest the reason and solution.
Seems you did not tried to find its answer.
try ->
pkill node* in shell
and restart your app.
Let me know if you were able to get through it or not?
Related
I'm trying to learn Appium but I'm already stuck in the beginning.
When I try to start Appium using the terminal I get an error message that looks like this:
Could not start REST http interface listener. The requested port may already be in use. Please make sure there is no other instance of this server running already.
Fatal Error: listen EADDRINUSE: address already in use 0.0.0.0:4723
So I tried to find out what instance is using that port using the statement lsof -i :4723
I found out there is a running node instance that uses this port so I tried to kill the instance with kill -9 PID . After I killed the instance I used lsof -i :4723 again to see if it worked but the node instance was still there but with a new PID. I guess the kill was successful but node just immediately starts a new instance and occupies the port 4237.
Is there anyone who might have an idea what I can try or maybe knows a solution to this problem?
I found a small workaround which works for now but shouldn't be final. When I use kill -9 PID | appium it works because Appium occupies the port immediately after kill got executed.
Thanks for your help in advance
Try running appium on different port appium -p 4725
The error shown with it, no idea to fix this. can someone help?
I am new with this thing.
The error is really clear. The errorcode EADDRINUSE shows that the port you are using for your NodeJS application already is in use. Therefore your NodeJS application can't connect to this port anymore. Close all applications that is using that port or use a port that is not in use.
I see that you are using Nodemon. It's possible that your nodemon process hang. This can be the result of unexpected close of the terminal or errors in your application.
Check all running nodemon processes by using the command:
ps -ef | grep node
And kill the process by using:
sudo kill -9 <PID>
I can no longer access my node.js application. I see thee following behaviours.
1> netstat shows the server listening on the port I expect it to.
2> tcpdump shows traffic from my laptop on the server when I attempt to open the page.
3> When I try to kill the node process with kill -9 or pkill node nothing happens.
I see the pid for the node process is changing continuously as if it was constantly being restarted. I see posts similar to this but none of them have definitive answers.
I have stopped and started the node site as we all restarting the host. Which I don't like doing as a problem resolution as you don't really know what the underlying problem is.
I also don't see an error log for node.
Any advice or guidance on how to determine what the problem is would be appreciated.
I am trying to debug my code using node-inspector but I am getting this error in my Terminal window again and again
$ sudo sails debug
info: Running app in debug mode...
info: You probably want to install / run node-inspector to help with debugging!
info: https://github.com/node-inspector/node-inspector
info: ( to exit, type <CTRL>+<C> )
Error: listen EADDRINUSE
at exports._errnoException (util.js:746:11)
at Agent.Server._listen2 (net.js:1156:14)
at listen (net.js:1182:10)
at Agent.Server.listen (net.js:1267:5)
at Object.start (_debugger_agent.js:20:9)
at startup (node.js:86:9)
at node.js:814:3
To resolve
Error : listen EADDRINUSE
I have tried closing other Terminal window (in which my node-inspector was running).
I have referred to the answers already here on StackOverflow but they didn't work
I have even tried giving this command to kill processes :
$ killall -9 node
No matching processes belonging to you were found
but still its not working.
Somebody please help me out with this.
I see that you are using sudo so this is not a permissions issue.
It definitely seems like the port is already in use. You should check to see which process is using the port, then kill that process.
There is a known issue with using sails debug on Node v12.0. There's a patch which will be released with the next version of Sails (v0.12).
In the meantime you can either install the edge version of Sails from Github or apply the patch yourself by replacing your Sails' /lib/hooks/grunt/index.js file with the contents of https://raw.githubusercontent.com/balderdashy/sails/88ffc0ed9949f8c74ea390efb5610b0e378fa02c/lib/hooks/grunt/index.js.
First, find your task that uses port 1337:
netstat -ano | findstr : 1337 (port number)
Then kill it:
tskill (process ID (PID))
It can solve your problem
I am using Neo4j 2.0.3 Community server by installing it on my linux system (by unzipping the tar.gz). I got this error while I tried to start the server
WARNING! You are using an unsupported Java runtime.
process [50690]... waiting for server to be ready.neo4j-community-2.0.3/bin/neo4j: line 147: lsof : command not found
.neo4j-community-2.0.3/bin/neo4j: line 147: lsof : command not found
.neo4j-community-2.0.3/bin/neo4j: line 147: lsof : command not found
. Failed to start within 120 seconds.
Neo4j Server may have failed to start, please check the logs.
I checked for the solution for this and came to know that /usr/sbin had to be added to the path. On doing so and restarting the server, I got the following message
Another server-process is running with [40903], cannot start a new one. Exiting.
However, when I run the command neo4j staus , it says
Neo4j Server is not running
Can anybody please help me with how should I get started with it?
This is very late, but might help others.
If it tells you this, and you check that process id with, for example, ps aux | grep 40903, and it's not neo4j, the problem might be that the port is being used.
By default neo4j uses 7474, but can change this on the neo4j folder /conf/neo4j-server.properties and that was my problem, I had set the port to '22' which was being used. SO make sure it is set to a port that is open and available.
Hope this helps.
You might want to examine the startup script.
Another server-process is running with [40903], cannot start a new one. Exiting.
indicates (me to) that there might be a pid file (or the script uses them) which was written and is checked before attempting to start a new instances. This the normal thing to do.
I think you need to kill the other process using kill
You can see this answer for how to kill the process:
https://unix.stackexchange.com/questions/8916/when-should-i-not-kill-9-a-process
Otherwise, restarting the operating system will also do the job. For me, I normally start neo4j in the console, as in ./neo4j console. This makes it easier to stop the process.