Change port of Theia editor within Cloud Shell

391 views Asked by At

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 kill {{PID of Theia process}} ...but it restarts again immediatelly
  • searched for settings within /google/devshell/editor/theia ...but could not find any port settings

sudo netstat -tlnp gives the following output: enter image description here

Any help is very appreciated.

2

There are 2 answers

9
Divyani Yadav On

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.

1
马治武 On

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

cloudshelledit