I am currently creating a website on Codeanywhere that communicates with a back-end API/server. I ran my server.js node script with my ports on 8080 (front-end) and 8081 (server). However, I normally close the connection with Ctrl + C but I accidentally used Ctrl + Z to close the server down and since then I cannot run it again. Since I accidentally used Ctrl + Z and closed the tab on codeanywhere before doing anything else out of fear of damage my local host on codeanywhere when I run the script will not connect but instead take too long and time out. I am desperate for a solution as this is for a university module.
2 Answers
Pressing Ctrl+z does not stop your application, it sends it to the background. I wouldn't describe it as being in a running state but resources (such as the port) it was previously using remains bound to it.
Your application was timing out because you were trying to start another instance that shared the same resource (port) as the paused one.
To fix, type fg in your terminal and it should restore your application.
I know this question was asked a long time ago but who knows who this answer might help.

- 633
- 10
- 19
You need to kill the node
process. By doing Ctrl Z
you are just suspending it, without freeing it's locked resources (like the TCP port your are listening to).
If no other Node.js processes are running and killall
is available you could easily do killall node
and then restart the server. Else use any tool to kill the node
process.

- 4,939
- 1
- 23
- 25
-
how would I use the killall command? would it work even if I pressed CTRL + Z then closed the tab and reopened codeanywhere? I can run the server node script just fine but as I mentioned, when I attempt to run it after the incident, it just hangs and I get a connection timed out error even though before it worked fine. – aaronthegod1 Nov 25 '17 at 22:52
-
Yes it should if the terminal is on the same container. In the worst case you can restart your container. – Fathy Nov 25 '17 at 22:54
-
I just restarted the container but same situation, it tries to connect then gives an error. It also doesn't appear to be running because using the killall isn't working – aaronthegod1 Nov 25 '17 at 22:57