Wrote a For Loop in a function node that was erroneous which i accidentally deployed, thereafter node-red went unresponsive, saw the infinite for loop output that was being displayed in node-red console. Used the command "node-red-stop" and restarted node-red again but it shows the error: port in use message. Restarted my raspberry pi and also my Windows laptop, but it still does not work. How can I resolve this issue?
If you get 'error: port already in use' it means node-red is already running.
Kill it first:
ps -e | grep -i node-red
make note of the first number in the first line it returns.
kill <number>
Then you can start it in safe mode with node-red --safe
, fix the flows and redeploy.
Oddly enough typing the code in terminal
ps -e | grep -i node-red
returned nothing though. Did i do something wrong?
can you type top
in the terminal and check if you see node-red ?
if not, you can try the --safe option.
windows.....
Will that command work?
Ok, sorry. A RasPi is also mentioned.
But it isn't clear on which one NR is running.
raspberry pi
i assume node-red is running there, @Razz can clarify.
Yeah, sorry. I read it and saw windows mentioned..... That may need clarifying.
Just sometimes it is the silly things that trap us.
Especially when I saw:
returned nothing though. Did i do something wrong?
Maybe ps
is not installed on that machine.
Sorry, still a new user to Node-red and Linux.
Was running NR previously on both Windows and on Raspberry Pi.
Ran top
, did not explicitly see NR running, only see 2 "Node" in the command line.
How do i also make sure that ps is installed?
If you got no error, then ps
is installed.
To see what has port 1880, try these...
sudo lsof | grep 1880
sudo ss -tulpn | grep :1880
Node-red is set to start up automatically when the machine is booted so if you rebooted after killing it, it would start up again.
You can see which process is using port 1880 with the command
ss -ltnup 'sport = :1880'
Assuming that ss is installed of course.
I doubt if any Linux system does not have ps installed, but you can tell by typing ps and enter!
Once you have identified and killed the application using port 1880, you can start up Node -red in safe mode to investigate further.
PS quick draw Steve beat me to it!
Thank you for the replies everybody,
When using the command
sudo lsof | grep 1880
sudo ss -tulpn | grep :1880
it returned the following below,
pi@raspberrypi:~ $ sudo lsof | grep 1880
sudo ss -tulpn | grep :1880
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
Output information may be incomplete.
node 1914 pi 20u IPv4 22921 0t0 TCP *:1880 (LISTEN)
node 1914 1919 node pi 20u IPv4 22921 0t0 TCP *:1880 (LISTEN)
node 1914 1920 node pi 20u IPv4 22921 0t0 TCP *:1880 (LISTEN)
node 1914 1921 node pi 20u IPv4 22921 0t0 TCP *:1880 (LISTEN)
node 1914 1922 node pi 20u IPv4 22921 0t0 TCP *:1880 (LISTEN)
node 1914 1923 node pi 20u IPv4 22921 0t0 TCP *:1880 (LISTEN)
node 1914 1925 node pi 20u IPv4 22921 0t0 TCP *:1880 (LISTEN)
node 1914 1926 node pi 20u IPv4 22921 0t0 TCP *:1880 (LISTEN)
node 1914 1927 node pi 20u IPv4 22921 0t0 TCP *:1880 (LISTEN)
node 1914 1928 node pi 20u IPv4 22921 0t0 TCP *:1880 (LISTEN)
node 1914 1929 node pi 20u IPv4 22921 0t0 TCP *:1880 (LISTEN)
tcp LISTEN 0 511 0.0.0.0:1880 0.0.0.0:* users:(("node",pid=1914,fd=20))
pi@raspberrypi:~ $ ss -ltnup 'sport = :1880'
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
tcp LISTEN 0 511 0.0.0.0:1880 0.0.0.0:*
Am i supposed to close all of these? If so how can i go about doing it?
No, just the parent (1914)
By parent I'm assuming the foremost one? How do I close it then?
sudo kill 1914
If the process ignores that command, follow up with
sudo kill -9 1914
I had a similar problem. After a while I figured out, that I had startet node-red with PM2 and forgot about it.
Ah yes, the issue has since been resolved with this command, thanks to Steve and everyone.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.