Reputation: 8015
I am using Code Server within my Cloud Shell. I need to use the port 3000 for a specific npm package. Unfortunately port 3000 is already used by the default editor Theia within Cloud Shell.
I have already tried the following:
sudo netstat -tlnp
gives the following output:
Any help is very appreciated.
Upvotes: 0
Views: 547
Reputation: 1
After searching for hours on directory /google I found a way to remove/stop port 3000 by copy and pasting this command in your Google cloud shell terminal, if you don't what port 3000 on Google cloud shell It's how you access Google cloud shell codeoss aka vscode
sudo rm -rf /google/devshell/editor/code-oss-for-cloud-shell
And once you have execute the command above go to port 3000 by clicking web view and click change port and port 3000 is stopped
Upvotes: -1
Reputation: 1
This is cloudshelledit occupy the port If you don't need cloudshelledit and can kill off And if you open the cloudshelledit, this process is not shut off
Upvotes: 0
Reputation: 1142
As mentioned by JShinigami, That issue got resolved here by changing the port of the other application, other alternative of resolving this issue is as below :
First I would recommend you to reset your cloud shell.
You can refer to the Answer to follow the steps on how to kill a process running on the particular Port.
Option 1 A One-liner to kill only LISTEN on specific port:
kill -9 $(lsof -t -i:3000 -sTCP:LISTEN)`
Option 2 If you have npm installed you can also run
npx kill-port 3000
I also found this answer on stack overflow that may be relevant as it shows how they were able to kill the process once they obtained its PID.
could you run the following command :
"sudo netstat -tlnp"
From the above you will be able to tell what processes are running on the ports. From there you will see the Possibility of "auto restart" configuration somewhere causing the process to appear even after kill command.
Found this useful article on ways to list processes running on ports.
Upvotes: 0