Can't run Vue2 js projects [duplicate] - vuejs2

i am testing a server written in nodejs on windows 7
and when i try to run the tester in the command line i get the following error
Error: listen EADDRINUSE
at errnoException (net.js:614:11)
at Array.0 (net.js:704:26)
at EventEmitter._tickCallback (node.js:192:40)
how can I fix it without rebooting?

Run:
ps -ax | grep node
You'll get something like:
60778 ?? 0:00.62 /usr/local/bin/node abc.js
Then do:
kill -9 60778

It means the address you are trying to bind the server to is in use. Try another port or close the program using that port.

On Linux (Ubuntu derivatives at least)
killall node
is easier than this form.
ps | grep <something>
kill <somepid>
Neither will work if you have a orphaned child holding the port. Instead, do this:
netstat -punta | grep <port>
If the port is being held you'll see something like this:
tcp 0 0.0.0.0:<port> 0.0.0.* LISTEN <pid>/<parent>
Now kill by pid:
kill -9 <pid>

The following command will give you a list of node processes running.
ps | grep node
To free up that port, stop the process using the following.
kill <processId>

You are getting the error EADDRINUSE because the port, which your application wants to use, is occupied by another process. To release this port, you need to terminate the occupying process.
Since you are on Windows, you can terminate the process using the command prompt (cmd). With the cmd you can discover the process ID (PID) of the blocking application. You will need the PID in order to terminate / kill the process.
Here is a step-by-step guide...
Find all processes which are running on a specified port (in this example, Port is "3000"):
netstat -ano | find ":3000 "
The netstat command will list up all processes running on the specified port. In the last column of the netstat results you can see the PIDs (in this example, PID is "8308"). You can find out more about a specific PID by running the following command:
tasklist /fi "pid eq 8308"
If you want to terminate a process, you can do that with the following command by using its PID (in this example, PID is "8308"):
taskkill /pid 8308 /f
Screenshot

When you get an error Error: listen EADDRINUSE,
Try running the following shell commands:
netstat -a -o | grep 8080
taskkill /F /PID 6204
I greped for 8080, because I know my server is running on port 8080. (static tells me when I start it: 'serving "." at http://127.0.0.1:8080'.) You might have to search for a different port.

suppose your server is running on port 3000
lsof -i tcp:3000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node 11716 arun 11u IPv6 159175 0t0 TCP *:3000 (LISTEN)
after that use kill -9 <pid>
in the above case sudo kill -9 11716

use below command to kill a process running at a certain port - 3000 in this example below
kill -9 $(lsof -t -i:3000)

One possible solution that worked for me was simply to close the window in browser where I had the corresponding "http://localhost:3000/" script running.

When you get an error
Error: listen EADDRINUSE
Open command prompt and type the following instructions:
netstat -a -o | grep 8080
taskkill /F /PID** <*ur Process ID no*>
after that restart phone gap interface.
If you want to know which process ID phonegap is using, open TASK MANAGER and look at the Column heading PID and find the PID no.

Check the Process ID
sudo lsof -i:8081
Than kill the particular Process
sudo kill -9 2925

The aforementioned killall -9 node, suggested by Patrick works as expected and solves the problem but you may want to read the edit part of this very answer about why kill -9 may not be the best way to do it.
On top of that you might want to target a single process rather than blindly killing all active processes.
In that case, first get the process ID (PID) of the process running on that port (say 8888):
lsof -i tcp:8888
This will return something like:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node 57385 You 11u IPv6 0xac745b2749fd2be3 0t0 TCP *:ddi-tcp-1
(LISTEN)
Then just do (ps - actually do not. Please keep reading below):
kill -9 57385

This works on Mac:
Step 1.
sudo lsof -i tcp:3000 (or whatever port you want to kill)
Above command will give you the Process Id(s) currently holding the port.
Step 2.
Kill -9 <pid>

you can change your port in app.js or in ur project configuration file.
default('port', 80)
and to see if port 80 is already in use you can do
netstat -antp |grep 80
netstat -antp |grep node
you might wanna see if node process is already running or not.
ps -ef |grep node
and if you find its already running, you can kill it using
killall node

I created 2 servers, listening on same port 8081, running from same code, while learning
1st server creation shud have worked
2nd server creation failed with EADDRINUSE
node.js callback delays might be reason behind neither worked, or 2nd server creation had exception, and program exited, so 1st server is also closed
2 server issue hint, I got from:
How to fix Error: listen EADDRINUSE while using nodejs?

Error: listen EADDRINUSE to solve it in Ubuntu run in terminal netstat -nptl and after this kill -9 {process-number} this command is to kill node process and now you can try to run again node server.js command
Ex
listen EADDRINUSE :::8080
netstat -nptl
tcp6 0 0 :::9000 :::* LISTEN 9660/java
tcp6 0 0 :::5800 :::* LISTEN -
tcp6 0 0 :::5900 :::* LISTEN -
tcp6 0 0 :::8080 :::* LISTEN 10401/node
tcp6 0 0 :::20080 :::* LISTEN 9660/java
tcp6 0 0 :::80 :::* LISTEN -
tcp6 0 0 :::22 :::* LISTEN -
tcp6 0 0 :::10137 :::* LISTEN 9660/java
kill -9 10401

I have node red installed on my Mac and my Raspberry Pi. Had the exact same problem and doing 'killall' didn't help. Once I shut down the Raspberry Pi and restarted my computer it worked fine.

It may be possible that you have tried to run the npm start command in two different tabs .you cant run npm start when it is already running in some tab.check it once .

To anyone who has tried all of the above, but still can't find the rouge process, try them all again but make sure you include "sudo" in front of the commands.

If you like UI more, find the process Node.js in windows task manager and kill it.

ps -ef |grep node
find app.js ,
kill pid of app.js

simply kill the node
as
pkill -9 node
in terminal of ubantu
than start node

You will need to kill the port by trying to use the following command on the terminal
$ sudo killall -9 nodejs

I have solved this issue by adding below in my package.json for killing active PORT - 4000 (in my case) Running on WSL2/Linux/Mac
"scripts": {
"dev": "nodemon app.js",
"predev":"fuser -k 4000/tcp && echo 'Terminated' || echo 'Nothing was running on the PORT'",
}
Source

I Just delete that (cmd) Terminal and open another terminal and run again
node myfile.js
it works awesomely for me.

It's might be too late but it's working like a charm.
You need pm2 to be installed
npm install -g pm2
To stoping the current running server (server.js):
pm2 stop -f server.js

It's year 2022 now and I am on Monterey (Mac user).
lsof -i tcp:3000
Kill -9 <PID shown in your list>

To kill node server first run this command in your terminal :
top
open another window then copy the server id from the previous window: PID number -9 kill
so now you killed your node server try again to run your app.

I used the command netstat -ano | grep "portnumber" in order to list out the port number/PID for that process.
Then, you can use taskkill -f //pid 111111 to kill the process, last value being the pid you find from the first command.
One problem I run into at times is node respawning even after killing the process, so I have to use the good old task manager to manually kill the node process.

In window, please execute this command:
taskkill /F /PID 1952

Related

Mac cant kill tomcat process

I can't stop the tomcat8 in IDEA, even I use 'kill process' button , it can't works. Who can help me?
enter image description here
My IDEA's version is 2017.2.5.
I usually run this: lsof -n -i4TCP:$PORT | grep LISTEN from command line
Where I replace $port with 8080 for example.
Example output:
java 20561 pim 80u IPv6 0x85f7db71b181d26b 0t0 TCP *:8080 (LISTEN)
And then kill the process manually (the PID is 20561 in this example) with:
kill -9 20561

Why my 8081 port is listening to some or the other process continuously even after kill process?

I am new to Coding and Computer Science, and i was working with React-native on Android Studio. Whenever i start to use the simulator on the machine it asks me this:
ERROR Packager can't listen on port 8081
Most likely another process is already using this port
Run the following command to find out which process:
Tough i have killed the process listening to Port 8081 the previous time i have started the simulator but it asks me agaain. Wants to understand what port 8081 is assigned to once it is killed using the taskkill /f /pid $$$$
Hey even i had the same issue,i solved it by the following:
1.) lsof -i :8081
2.) kill -9 <PID> kill the process that is running on the port 8081 by specifing the PID that you get as a result of step 1.
OR
You can try running it on another port by using the command 'react-native start --port=8088'
If you get an error stating "Could not connect to development server" then try npm start,it should work.

Getting the error "Apache port:443 is being used by another application" after installing AMPPS

After installing AMPPS for Windows, while trying to launch Apache I get an error saying,
Apache port:443 is being used by another application.
I do not have any other programs (that I know of) such as Skype that are currently running. How can I monitor my 443 port or change the port for Apache?
By the way, I have McAfee as an anti-virus.
Open command prompt(start -> run -> cmd) and type the following command :
C:\> netstat -aon | findstr 0.0:443
Last column of the output is the PID of the application using port 443.
You can find the application name in Task Manager. Go to Process Tab then in Menu Bar of Task Manager go to View -> Select Column -> Check "PID" and press Ok. Search for the PID in the list(Click Below "Show processes from all users" in case if you don't find the PID), corresponding process is the application which is using port 443. Stop or Uninstall it to make your AMPPS Apache work.
For terminate any process:
open cmd as administrator
netstat -aon | findstr 0.0:443
shows: TCP 0.0.0.0:443 0.0.0.0:0 LISTENING 4876, NOTE THE PID 4876
taskkill /pid 4876 /f
For disable port of other program(vmware):
open VMware Workstation
Edit->Preferences...->Shared VMs->Change Settings->Yes->Disable Sharing
You can change the port. -> Ok
I was facing the same issue as on port 443, vmware service was running, i went to task manager and stopped the service and then started apache and it worked fine.
After getting the pid number using netstat -aon | findstr 0.0:443, if you are having trouble finding pid 443 in Task Manager then:
Kill the process 443 by using the cmd: taskkill /pid 443.
You will avoid downloading any software or any other headache.
Here is the more elaborated way to solve this issue based on comments from Jigar and Daniel Dropik(Thank You guys),
So check with which service you are getting this port issue, in my case it was with Apache and MySQL.
Starting with Apache, either click on "Logs" in XAMPP control panel and open error log to see the problem or go to XAMPP installation directory and run "apache_start.bat" batch file, this will also give to the problem cause.
Now you have got the Port number which causing trouble,
Now follow Jigar's comment and run
netstat -aon | findstr 0.0:443
Remember 443 is the port number so enter the port number causing the issue.
This command will give the PID of the process using the port like below,
TCP 0.0.0.0:443 0.0.0.0:0 LISTENING 4996
So 4996 is the process ID(PID) that you want to stop.
Now using Task Manager you could see and kill the process but some processes could not displayed by Task Manager, in this case you have to download Mycrosoft's Process Explorer, unzip the downloaded package and run the ".exe" file as an Administrator.
You will find a bunch of processes running, sort them using PIDs and you will find your service.
Select that service and stop it.
Then go to the XAMPP control panel and run Apache and you will be able to start it this time.
Follow same process for MySQL as well.
Enjoy :)
First off you must find the process using that port. we can find it with below command.
netstat -aon | findstr 443
then we might finish finded process either below command:
taskkill /PID PORTNUMBER /F
OR
you can go to taskmanager and find the process from process bar ( with swiching PID column) and click on end task.
go to Ampps\apache\conf\extra
open file httpd-ssl.conf with note++
change the port
Listen 443--->change port
VirtualHost default:443--->"change port **>
DocumentRoot "D:/Ampps/www"
ServerName localhost:443--->**change port
and saved

Warning: remote port forwarding failed for listen port 52698

I'm using SSH to access my university's afs system. I like to use rmate (remote TextMate), which requires SSH tunneling, so I included this alias in my .bashrc.
alias sshr=ssh -R 52698:localhost:52698 username#corn.myschool.edu
It has always worked until now.
I had the same problem. In order to find the port that is already open, you have to issue this command on the 'corn.myschool.edu' computer:
sudo netstat -plant | grep 52698
And then kill all of the processes that come up with this (replace xxxx with the process ids)
sudo kill -9 xxxx
(UPDATED: changed the option to be -plant as it is a nice mnemonic)
I had another SSH connection open. I just needed to close that connection before I opened my SSH tunnel.
Further Explanation:
Once one ssh connection has been established, subsequent connections will produce a message:
Warning: remote port forwarding failed for listen port 52698
This message is harmless, as the forward can only be set up once and one forward will work for all ssh connections to the same machine. The original ssh session that opened the forward will stay open when you exit the shell until all remote editing sessions are finished.
I experienced this problem, but it was while connecting to a server on which I don't have sudo priviliges, so the top response suggesting runing sudo netstat ... wasn't feasible for me.
I eventually figured out it was because there were still instances of rmate running, so I used ps to list the running processes and then kill -9 pid (where pid is the process ID for rmate).
This solved my problem reported here as well. To avoid this notification "AllowTcpForwarding" should be enabled in SSH config.
In my case, the problem was that the remote system didn't have DNS properly set up, and it couldn't even resolve its own hostname. Make sure you have a working DNS in /etc/resolv.conf at the remote system.

Starting apache fails (could not bind to address 0.0.0.0:80)

Update: Already fixed, it seems that one of VirtualHosts configurations files was wrong in sites-enabled.
I have Ubuntu 11.10
When I run the command to start apache2:
sudo /etc/init.d/apache2 start
I get the following error message:
Starting web server apache2
apache2: Could not reliably determine the server's fully qualified
domain name, using 127.0.1.1 for ServerName (98)Address already in
use: make_sock: could not bind to address 0.0.0.0:80 no listening
sockets available, shutting down Unable to open logs Action 'start'
failed.
I run this command in order to get the process that is using the port 80:
sudo netstat -ltnp | grep ':80'
Which returns this output:
tcp6 0 0 :::80 :::* LISTEN 1176/
To know which process is I run this command:
ps -wlp1176
That returns:
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
5 D 33 1176 1 0 80 0 - 0 exit ? 00:00:00 apache2
But if I try to kill the process:
sudo kill -9 1176
It doesn't kill it, if I run again the netstat command still appears listening and apache start fails.
Any suggestions?
Worked for me running this command:
fuser -k -n tcp 80
It may be skype or nginx using the port 80.
Try shutting down skype, or running: sudo /etc/init.d/nginx stop
I had the same error, and just want to confirm that running
sudo netstat -ltnp | grep ':80'
helped me indicate that Hiawatha webserver was in the way of Apache2.
Removing Hiawatha fixed the issue (sudo dpkg --purge hiawatha).
Ubuntu 12.04.2 server.
I had the same problem
For me, apache was already running but it was running the wrong way.
Killing processes didnt work because a daemon kept reinstantiating it.
apachectl stop
resolved the issue.
use either
sudo killall httpd
or
sudo killall apache2
check if some one using the 80 port
sudo netstat -tulpn| grep :80
The restart
sudo service httpd start
then restart the server.It took me a whole day to understand the issue
Try this, it works for me…
sudo netstat -ltnp | grep ':80'
This would return the following:
tcp6 0 0 :::80 :::* LISTEN 1047/apache2
Then
sudo kill -9 1047
Then I was able to restart Apache and everything was working fine.
Go to device manager, select “show hidden devices” from menu/view, go to “Non-Plug and Play Driver”/HTTP, double click it to disable it (and disable or manual some services depended on it).
Reboot and enjoy!
This will happen because of repeated installation of apache or port is using by another service
sudo lsof -i | grep "httpd"
You will find process id and listening port of service. Then check
cd /proc/(process id of http)
Then kill that process using command
kill -9 pid
now
sudo netstat -nltp
again kill the process
syntax:-
kill -9 pid
and now start apache
sudo ./apachectl start
It look like other process is using port 80.
$ netstat -anp | grep
eg. $ netstat -anp | grep 80
by above you get process name, if you want to use port then you need to stop the process or change the port
What I would do is simply check if the following is set in your /etc/apache2/sites-available/your-domain-name.com.conf
SSLEngine on
SSLCertificateFile /your/path/to/your-domain.com.crt
SSLCertificateKeyFile /your/path/to/your-domain.com.key
SSLCACertificateFile /your/path/to/your-domain.com.ca-bundle
and there aren't any mistyped directories or anything else that would not supposed to be in your .conf file. It did the trick for me as re-starting and killing the processes did not help at all. It did not start anyway.
I fixed it by using below procedure.
Run below command as root user.
root# ps aux |grep apache
It will show you Apache PID, just kill that PIDs and restart Apache Server.
You can only have listen PORTNUMBER in only one file of .conf. Do not put it in multiple files. Try it :)