There were numerous moments when I couldn’t start a docker project or a node/nuxt/vue instance because on the WSL some ports were already opened by other processes (usually same processes that I started but didn’t close).
Now I simply do the following:
sudo netstat -nlpt |grep 3000
… where “3000” is the port. This usually returns something like:
tcp6 0 0 :::3000 :::* LISTEN 200129/node
… where “200129” is the process that is using the port. After I get the process id, I close it like so:
sudo kill -9 200129