How to close npm local tunnel port? - npm

I had opened my localhost to the internet for a webhook using npm local tunnel and done my job. Now I'm exposing my port unnecessarily, I could still access my port using the URL. Now I need to close the tunnel. What should I do?
Long time ago, I shut down node service and the port closed. But now I can't find npm or node in my service.
I need a simple command to close the port i.e. unexpose my port.
Commands I used:
npm install localtunnel
lt --port=8080

Related

Cannot bind to port 8080. It is probably taken by another application or you don't have enough privileges

I deleted my XAMPP from the applications folder(without uninstalling) and installed it again then I tried to change my apache port 8080 after that this problem showed up 'Cannot bind to port 8080. It is probably taken by another application or you don't have enough privileges'
I tried to fix it by uninstalling and installing again it didn't work then I deleted cache files of XAMMP with some sudo code but it didn't work anyway
in windows to check what ports applications are running on, open command prompt as admin and type "netstat -a -b"
stop whatever application is running on port 8080

How to fix ngrok forwarding port?

I am ssh-ing onto a remote desktop. Since I have to connect over the internet, I have exposed the ssh port (22) on the remote side using ngrok, and everything is working great. I connect to the desktop using the command
ssh username#2.tcp.ngrok.io -p portno
where I get the portno from the remote side, when I start the ngrok service from the line that says
Forwarding tcp://2.tcp.ngrok.io:portno -> localhost:22
However, everytime I start a new ngrok session on the remote side, a new portno is generated. Now, unless I have a secondary connection open (typically using teamviewer), I would not be able to know what that port number is.
How can I start the ngrok service with a fixed portno. This is because I want to have the ngrok service on startup as I would have to restart my remote desktop a couple of times and still want to connect to the desktop using ssh.
Thanks.
You'll need to reserve a TCP address on ngrok, which will give you a fixed address.
To associate a tunnel with a reserved TCP address, you should include the remote-addr option in your ngrok config when starting the tunnel.
An example from the docs: ngrok tcp --region=us --remote-addr 1.tcp.ngrok.io:20301 22

Making `http-server` visible across the network

Running npm's http-server will sometimes launch a server accessible from a (mobile) device on the same network.
> http-server
Starting up http-server, serving ./
Available on:
http://127.0.0.1:8080
http://10.0.1.7:8080
http://123.456.78.90:8080
Hit CTRL-C to stop the server
and sometimes launch a server that is visible only from the same desktop.
> http-server
Starting up http-server, serving ./
Available on:
http://127.0.0.1:8080
http://10.0.1.7:8080
Hit CTRL-C to stop the server
How do I use http-server to launch a web server that's visible from any device on the same network?
The presence of http://10.0.1.7:8080 should by itself indicate that the server is visible across the network, no?
Why does the third address http://123.456.78.90:8080 appear only sometimes. Both launchings are identical.
All this follows npm install -g http-server of course.
Update 1:
http-server -a 0.0.0.0 is the default. (Hence it need not be specified.)
Update 2:
Using
python3 -m http.server --bind 0.0.0.0
is more predictable/reliable, but then one has to go muck around in ifconfig's output to find the IP revealed so nicely by npm's http-server.
It should always be available to anyone in the same network as your computer under your computer's IP followed by the port.
The third address, I assume, appears because at the time you were connected to two local networks at the same time, so that the http server would be available at that IP - which is also the IP of your computer, but in the second network.
So in short:
http://127.0.0.1:8080 is the IP that is used to connect to the server from WITHIN the machine it runs on.
http://10.0.1.7:8080 and any subsequent IP is the IP used to connect to the server from any device that is in the same network. As many IP's appear as how many local networks you are connected to.
This has nothing to do with npm, it's just how the network works. Python's http server just doesn't list the IP's for you.
Let's try to exclude some obvious cases:
What error message do you get? Do you see a connection timeout page in your browser?
Is your mobile phone connected to the same router the http-server machine does?
What is the IP of your mobile phone? (i can see it e.g. in my router)
You don't use any vpn on your other device, do you?
Do you see the right result when you call it locally?
Can you ping the http-server machine from any device within your network?
Did you try to use another port e.g 80?

NPM local server port increments by 1

new to VueJS here. Normally, vue runs the project at localhost:8080
I noticed lately that the moment I'm restarting my local server running at localhost:8080 through npm run dev command, the default port just increased it's value by 1. (btw, i just had that screenshot few moments ago)
Is this some sort of an issue?
Maybe the port 8080 and 8081 are already in use. You should make sure that you shutdown the running instances of the server before starting a new one.

Github SSH via institute proxy, port 22 as well as port 443 blocked

There's a stackoverflow question # Github (SSH) via public WIFI, port 22 blocked, about blocked port 22, but the solution given there: port 443 is also failing for me.
All my connections to the internet go through the Institute proxy server, and it blocks all non-standard ports. I know for a fact that port 80 and port 8080 are both allowed, and all my github transactions through the https route work perfectly.
How to solve this issue?
ssh -T -p 443 git#ssh.github.com
ssh: connect to host ssh.github.com port 443: Connection refused
My proxy server is : http://10.3.100.207:8080/
I found a simple solution to my problem. Since https works perfectly for my setup and proxy, I found a way to force git to use https instead of ssh, whenever it encounters ssh urls, by executing the following 2 git config commands:
git config --global url."https://github.com/".insteadOf git#github.com:
git config --global url."https://".insteadOf git://
This solved the problem for me.
Source: https://github.com/npm/npm/issues/5257
Your problem is that your connection is not going through the institute proxy server, which from your description looks like a basic HTTP proxy. Git -- and ssh -- don't know about the proxy. You have several options:
Access github using https, and let git know about the proxy server by setting the http.proxy configuration option. There are instructions for doing that here.
Configure ssh to make use of the proxy. This will require a tool like corkscrew that can forward tcp connections through an http proxy (if the proxy supports the CONNECT method). There is some useful documentation on that topic here.